-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61ea97a
commit c24d6f6
Showing
13 changed files
with
90 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
arduino/arduino_homerrr_dimmWorking/arduino_homerrr_dimmWorking.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
String cmd; | ||
int fullValue; | ||
int pin; | ||
int value; | ||
int inorout; | ||
void setup() { | ||
|
||
Serial.begin(9600); // initialize serial communication | ||
Serial.setTimeout(100); | ||
} | ||
void loop() { | ||
// see if there's incoming serial data: | ||
if (Serial.available() > 0) { | ||
//fullValue = Serial.parseInt(); | ||
//Serial.println(fullValue); | ||
pin = Serial.parseInt(); | ||
//pin = Serial.read(); | ||
Serial.println(pin); | ||
value = Serial.parseInt(); | ||
Serial.println(value); | ||
inorout = Serial.parseInt(); | ||
Serial.println(inorout); | ||
if(inorout == 1) { | ||
pinMode(pin, OUTPUT); | ||
analogWrite(pin,value); | ||
} else { | ||
pinMode(pin, INPUT); | ||
} | ||
//incomingByte = Serial.read(); // read the oldest byte in the serial buffer | ||
//Preform the code to switch on or off the leds | ||
//Serial.println(); | ||
//Serial.println("Serial Read"); | ||
//Serial.print("incomingByte", BIN); | ||
//Serial.println(); | ||
//Serial.println(incomingByte, DEC); | ||
//if (incomingByte == '0') { | ||
//digitalWrite(ledPin13, HIGH); //If the serial data is 0 turn red LED on | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
<?php | ||
|
||
//check the GET action var to see if an action is to be performed | ||
if (isset($_GET['pin'])) { | ||
|
||
//Load the serial port class | ||
require("php_serial.class.php"); | ||
$serial = new phpSerial(); | ||
$serial->deviceSet("/dev/cu.usbmodem1421"); | ||
$serial->confBaudRate(115200); | ||
$serial->confBaudRate(9600); | ||
$serial->deviceOpen(); | ||
$pin = $_GET['pin']; | ||
$value = $_GET['value']; | ||
error_log($value); | ||
$direction = $_GET['direction']; | ||
// send values to arduino | ||
$serial->sendMessage($pin,$value,$direction); | ||
//error_log('get' . $pin . ' ' . $value . ' ' . $direction); | ||
//$serial->sendMessage($pin . '?value=' . $value . '?direction=' . $direction); | ||
$serial->sendMessage('A'.$pin .'B'.$value.'C'.$direction); | ||
//$serial->sendMessage($value); | ||
//Issue the appropriate command according to the Arduino source code 0=Green On, 1=Green Off, 2=Red On, 3=Red Off. | ||
|
||
// close serial connection | ||
$serial->deviceClose(); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
jQuery(function () { | ||
//Controller | ||
|
||
var that = this; | ||
jQuery('form', this.ctx).submit(function (ev) { | ||
jQuery(this).find('.btn').addClass('loader'); | ||
//jQuery(this).find('.btn').addClass('loader'); | ||
jQuery.ajax({ | ||
type: jQuery(this).attr('method'), | ||
url: jQuery(this).attr('action'), | ||
data: jQuery(this).serialize(), | ||
success: function (data) { | ||
//alert('ok'); | ||
jQuery(this).find('.btn').removeClass('loader'); | ||
//jQuery(this).find('.btn').removeClass('loader'); | ||
} | ||
}); | ||
ev.preventDefault(); | ||
|
||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
<?php | ||
|
||
//check the GET action var to see if an action is to be performed | ||
if (isset($_GET['pin'])) { | ||
|
||
//Load the serial port class | ||
require("php_serial.class.php"); | ||
$serial = new phpSerial(); | ||
$serial->deviceSet("/dev/cu.usbmodem1421"); | ||
$serial->confBaudRate(115200); | ||
$serial->confBaudRate(9600); | ||
$serial->deviceOpen(); | ||
$pin = $_GET['pin']; | ||
$value = $_GET['value']; | ||
error_log($value); | ||
$direction = $_GET['direction']; | ||
|
||
error_log('get' . $pin . ' ' . $value . ' ' . $direction); | ||
// send values to arduino | ||
$serial->sendMessage($pin,$value,$direction); | ||
//error_log('get' . $pin . ' ' . $value . ' ' . $direction); | ||
//$serial->sendMessage($pin . '?value=' . $value . '?direction=' . $direction); | ||
$serial->sendMessage('A'.$pin .'B'.$value.'C'.$direction); | ||
//$serial->sendMessage($value); | ||
//Issue the appropriate command according to the Arduino source code 0=Green On, 1=Green Off, 2=Red On, 3=Red Off. | ||
|
||
// close serial connection | ||
$serial->deviceClose(); | ||
} | ||
?> | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.