This code runs the smore making robot.
- Install VS Code and PlatformIO by following this guide: https://platformio.org/install/ide?install=vscode
- In VS Code, choose File > Open Folder and open the
smore-botfolder. - Wait for PlatformIO to finish loading. The first time takes a few minutes.
-
Turn on the robot's 24V power.
-
Plug the controller into your computer with a USB cable.
-
Click the terminal button in the bar along the very bottom of VS Code.
-
Type this command and press Enter:
pio run -e p1am_200 -t upload -
Wait for the word
SUCCESS. If you seeFAILED, go to part 4.
The serial monitor shows messages from the robot.
-
Click the plug button at the top right of VS Code.
-
The robot's messages appear.
This picture shows the monitor trying to connect with no board plugged in. With the robot plugged in, you also see its messages.
-
To send a command, type it and press Enter.
-
To close the monitor, click in it and press Ctrl+C.
Close the monitor before you send new code.
Try these one at a time:
- Close the serial monitor.
- Unplug the USB cable, wait 5 seconds, and plug it back in.
- Try a different USB cable or USB port. Some cables only charge.
- Check that the robot's 24V power is on.
- Press the small reset button on the controller two times fast. Then send the code again.
- Close VS Code, open it again, and try again.
Debug mode lets you check each part of the robot, one at a time, instead of running the whole line.
-
Type
debugand press Enter. The robot stops and printsDebug mode. -
Every 5 seconds it shows a line like this:
start:ON cancelCook:off mmExit:off run:off oven:72FPress the start button. The next line says
start:ON. Try the same with the marshmallow sensor (mmExit) and the run switch (run). -
Keep your hands clear. The station moves as soon as you press Enter.
Type a station name and press Enter:
Name Station beltConveyor belt gc1First graham cracker chChocolate mmMarshmallow ovenOven gc2Top graham cracker A station finishes its whole move once it starts.
gc2takes about 24 seconds. -
Type
debugagain. It printsSmore modeand runs the robot normally.
Every 15 seconds the serial monitor prints Debug mode or Smore mode, so
you can always tell which one the robot is in.
Keep your hands clear while the robot runs. The oven gets hot.
- Flip the run switch on. It is the small switch on the controller. The belt starts.
- Press the start button to make a smore. It waits 1 second before moving, so step back after you press it.
- Flip the run switch off to stop.
- Take everything off the belt before you turn it back on.
- Type
statusin the serial monitor to see what each station is doing. - Type
cancel cookto stop the oven early and let the tray move on. This only does anything while the oven is actually toasting. A cancel cook button does the same thing once one is wired in (seeinclude/Config.h).
To stop in an emergency, press the e-stop button.
Times are in include/Config.h. 1000 means 1 second.
This checks the robot's logic on your computer. The robot does not need to be plugged in.
pio test -e native


