add digital write functionality

This commit is contained in:
Shannon Sterz 2016-01-20 17:00:46 +01:00
parent d823541934
commit 3a376ebc7e

View file

@ -35,7 +35,7 @@ void decodeMessage() {
switch (cmd) { switch (cmd) {
//case 80: break; //case 80: break;
case 81: setMode(val[0], pin); break; case 81: setMode(val[0], pin); break;
//case 82: break; case 82: digitalW(val[0], pin) break;
//case 83: break; //case 83: break;
//case 84: break; //case 84: break;
//case 85: break; //case 85: break;
@ -72,6 +72,19 @@ void setMode(uint8_t val, int pin) {
} }
void digitalW(uint8_t val, int pin) {
if(pin == -1) { if(debug) Serial.println("badpin"); return; }
pinMode(pin, OUTPUT);
if(val == 0) {
digitalWrite(pin, LOW);
} else {
digitalWrite(pin, HIGH);
}
}
void sendRCTristate (uint8_t val[], int pin) { void sendRCTristate (uint8_t val[], int pin) {
if(pin == -1) { if(debug) Serial.println("badpin"); return; } if(pin == -1) { if(debug) Serial.println("badpin"); return; }