add digital write functionality
This commit is contained in:
parent
d823541934
commit
3a376ebc7e
1 changed files with 14 additions and 1 deletions
|
@ -35,7 +35,7 @@ void decodeMessage() {
|
|||
switch (cmd) {
|
||||
//case 80: break;
|
||||
case 81: setMode(val[0], pin); break;
|
||||
//case 82: break;
|
||||
case 82: digitalW(val[0], pin) break;
|
||||
//case 83: break;
|
||||
//case 84: 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) {
|
||||
|
||||
if(pin == -1) { if(debug) Serial.println("badpin"); return; }
|
||||
|
|
Reference in a new issue