Hello there,
I’m a student working on a physical computing group project, and I would GREATLY APPRECIATE ANY HELP AT ALL. Please.
We’re working on using the Photon to control two servos (attached to wheels) on a small tabletop robot we’ve created using laser cut acrylic.
So, registered my Photon and everything was going great and Blink was working, and my teammate put her code on here (to control the servos), wired the board up so that we would have a push button to trigger the motors, and BRIEFLY, it worked!
And then, once we disconnected the Photon and tried again, we couldn’t even get it to run Blink.
It’s actually stuck in breathing green right now. We can’t even Flash anything at it. Whatever forms of Safe Mode and resets we’ve done (it feels like all of them) have NOT done anything.
At first, we thought it was an issue with the Photon. Even our professors thought so. HOWEVER, we’ve now run into this same issue on THREE different Photons.
I’ll attach the code below. We all looked through it and we can’t figure out what might be wrong.
I’d really, really appreciate help on this, as our project is due in four days.
Please. Help.
The first line reads #include < application.h > but without the spaces between the <> keys and application.h. Sorry, can’t figure out how to make it not format as a title.
#include <application.h>
Servo left;
Servo right;
//Black/White Sensor values
int bwval = 0;
const int bwsens = A0;
int pos1 = 94;
int pos2 = 94;
//speeds in directions
// for LEFT 94 is neutral!!! <= 93 is clockwise >= 95 is counterclockwise
// for RIGHT 96 is neutral!!! <= 95 is clockwise >= 97 is counterclockwise
// LEFT
const int lneutral = 94;
const int lfastcwise = 0;
const int lfastccwise = 180;
const int lslowcwise = 93;
const int lslowccwise = 95;
const int lmedcwise = 45;
const int lmedccwise = 135;
//RIGHT
const int rneutral = 96;
const int rfastcwise = 0;
const int rfastccwise = 180;
const int rslowcwise = 95;
const int rslowccwise = 97;
const int rmedcwise = 45;
const int rmedccwise = 135;
void setup() {
left.attach(D0);
right.attach(D1);
pinMode(bwsens, INPUT_PULLUP);
}
void loop() {
do{
bwval = digitalRead(bwsens);
}
while (bwval == HIGH); {
left.write(lmedcwise);
right.write(rmedccwise);
} while (bwval == LOW); {
left.write(lneutral);
right.write(rneutral);
}
// while (bwval == LOW); {
// left.write(lslowcwise);
// right.write(rslowccwise);
// }
}