- Joined
- Dec 15, 2011
- Messages
- 905
- Mac
- Classic Mac
- Mobile Phone
Thanks for the hint, Kiwi. I will try that as soon as I've finished my new tests with a tiny little P-Channel Mosfet. See my thread.
MacTester
MacTester
Glad it worked, i didn't think it would be too difficult. Are you able to post your code, so I can update, or if you have a Git Hub account create a pull request.Kiwi,
I've just implemented your "OK handshake" in the slider applet and in my Arduino sketch. It appears, that the serial communication is fixed now.
Thanks again!
//----Serial interface
// This function processes the inverter related serial commands
void processCommandBrightness(String subCmd, String extraCmd) {
noInterrupts();
if (subCmd.equals("R")) {
// Brightness Read (from the Arduino)
Serial.println(inverterBrightness);
} else if (subCmd.equals("+")) {
// increase brightness
increaseBrightness();
serialCommandReceived();
} else if (subCmd.equals("-")) {
// decrease brightness
decreaseBrightness();
serialCommandReceived();
} else if (subCmd.equals("W")) {
// Brightness Write value BWnnn - nnn is the value
adjustInverter( extraCmd.toInt() );
serialCommandReceived();
} else if (subCmd.equals("A")) {
// Activate Inverter
enableInverter();
serialCommandReceived();
} else if (subCmd.equals("D")) {
// Deactivate Inverter
disableInverter();
serialCommandReceived();
} else {
Serial.println(F("Brightness Command Unknown: BR (read), BW (write), BA (activate), BD (deactivate), B+, B- (change)"));
}
interrupts();
}
// This function sends "OK" back to the Slider Applet
void serialCommandReceived() {
Serial.println("OK");
}
Part 22 - Breathing LED
There has been some work done on describing the breathing led on this forum, so thought would document my implementation. From what I have read there is a 5 second cycle, where the first 1.5 seconds is the fade up, and then 3.5 seconds fade down to zero. From my observations there is also a gap at the end of the fade down, and the start of the next fade up.