MicroTrac Controller v17.10/Code: Difference between revisions
Jump to navigation
Jump to search
(→Goals) |
|||
Line 9: | Line 9: | ||
**Create a program to define the EEPROM | **Create a program to define the EEPROM | ||
*Operate relay switches when "HAND" switch is on | *Operate relay switches when "HAND" switch is on | ||
*Test different turning methods. | |||
**stop and turn | |||
**fether on/off to turn on a curve | |||
***is this too jerky | |||
=Terms, Pins and Variables= | =Terms, Pins and Variables= |
Revision as of 17:08, 29 October 2017
Goals
- Establish serial communication over xbee radio
- Transmit commands from the "remote controller" box to "onboard controller" box.
- Attempt to run identical arduino control software on both boxes.
- Will run in onboard mode if jumper set between defined pins.
- When in onboard mode, transmit GPS location.
- Boxes will ping each other and will shut down if connection lost.
- Store radio information in EEPROM. Update on startup.
- Create a program to define the EEPROM
- Operate relay switches when "HAND" switch is on
- Test different turning methods.
- stop and turn
- fether on/off to turn on a curve
- is this too jerky
Terms, Pins and Variables
Each Solenoid and corresponding relay switch will be defined by a single alphabet letter.
- A - Left Track Forward
- B - Left Track Backward
- C - Right Track Forward
- D - Right Track Backward
- E - Arms Up
- F - Arms Down
- G - Bucket Up
- H - Bucket Down
AT Commands
- ATIDXXXX - set radio network ID
- ATWR - save settings to long term memory
Code Theory
When a switch is thrown, its letter followed by a 1 or 0 will be transmitted over serial.
- example: "E1" will engage the solenoid to raise the arms. "E0" will turn off the solenoid and will stop raising the arms.
- While "F1" will lower the arms and "F0" will stop lowering the arms.
If vehicle is stopped, gather and transmit position and orientation data. otherwise briefly stop vehicle every X minutes.
Code
Controller Box
void setup() { //SET PINS AS INPUT FROM TOGGLE SWITCHES //SET PINS AS OUTPUT TO RELAY MODULE //CREATE STRING String string_currentstate ="abcdefgi"; //START COMMUNICATING WITH XBEE Serial.begin(9600); } void loop() { if pin string_currentstate +="a"; print string_currentstate; string_currentstate = "";