better Serial feedback

This commit is contained in:
Shannon Sterz 2016-01-28 19:32:36 +01:00
parent 750f778d19
commit 2d249d7567

View file

@ -104,6 +104,9 @@ void digitalW(uint8_t val, int pin) {
digitalWrite(pin, HIGH);
}
Serial.print(pin);
Serial.print('::');
Serial.println(val);
}
void digitalR(int pin) {
@ -111,7 +114,9 @@ void digitalR(int pin) {
if(pin == -1) { Serial.println("badpin"); return; }
pinMode(pin, INPUT);
int digraw = digitalRead(pin);
Serial.println(String(pin + '::' + digraw));
Serial.print(pin);
Serial.print('::');
Serial.println(digraw);
}
@ -120,6 +125,9 @@ void analogW(uint8_t val[], int pin) {
if(pin == -1) { Serial.println("badpin"); return; }
pinMode(pin, OUTPUT);
analogWrite(pin,firsTwoToInt(val));
Serial.print(pin);
Serial.print(' wrote ');
Serial.println(val);
}
@ -131,6 +139,7 @@ void analogR(int pin) {
Serial.print(pin);
Serial.print("::");
Serial.println(rval);
}
void handleRCDecimal(uint8_t val[], int pin) {
@ -141,7 +150,8 @@ void handleRCDecimal(uint8_t val[], int pin) {
RCSwitch rc = RCSwitch();
rc.enableTransmit(pin);
rc.send(value, length);
Serial.print('RC Decimal: ');
Serial.println(value);
}
void sendRCTristate (uint8_t val[], int pin) {
@ -169,10 +179,7 @@ void sendRCTristate (uint8_t val[], int pin) {
}
void irSend(int type, int length, unsigned long val) {
char m[22];
sprintf(m, "%04d::%04d::%09lu", type,length,val);
Serial.println(m);
for(int i = 0; i < 3; i++) {
switch (type) {
case RC5: irsend.sendRC5(val, length); break;
@ -210,9 +217,11 @@ void irRead(decode_results *results) {
unsigned long codeValue = results->value;
int codeLen = results->bits;
char m[22];
sprintf(m, "%04d::%04d::%09lu", codeType,codeLen,codeValue);
Serial.println(m);
Serial.print(codeType);
Serial.print('::');
Serial.print(codeLen);
Serial.print('::');
Serial.println(codeValue);
}
}