55: Use a Photon as an Arduino
"Arduino Mode": Who needs it? Well, I have -- a couple of times. Here are some reasons:
3. A Photon is a 32-bit computer. It is 2x+ faster and has 4x program memory. About the same footprint as an Arduino Nano.
2. Photon analog ports are 12 bits to Arduino's 10 bits = higher resolution readings.
1. Most important: So you can test a Photon setup before Internet has been installed. This is why I've needed Arduino-mode!
I recently had to try a Photon setup "out in the field" and ended up reprogramming it for a Nano. I commented out the Cloud stuff, re-did the analog values, found that I had an "int" overflow (changed it to "long". And had to move the breadboard wires to fit the Nano (and later back for the Photon).
So I complained to Particle and was advised to try MANUAL mode, like this--
SYSTEM_MODE(MANUAL); // this kludge has to be before setup()
void setup() {
Serial.begin(9600); // you'll need to talk to it
. . .
}
void loop() {
. . .
if(!Serial.available()) {
delay(1000); // some number
return;
}
// read a command
ch = Serial.read(); // get 1st character
if(ch == 'c') { // some value: switch back to connected
// so you can later flash new code without reset
Particle.connect();
}
. . .
So, for $19 you can have a bigger, better Nano.
No comments:
Post a Comment