diff --git a/LICENSE b/LICENSE index acbff5a..921921d 100644 --- a/LICENSE +++ b/LICENSE @@ -2,7 +2,8 @@ MIT License Copyright (c) 2017 Alistair Lynn, Thomas Leese 2017-2018 Jake Howard, Kier Davis, Peter Law - 2018 Dan Trickey + 2018-2022 Dan Trickey + 2023 SourceBots Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index d6b1e86..cdd3b03 100644 --- a/README.md +++ b/README.md @@ -2,31 +2,32 @@ The firmware for SourceBots' Arduino Uno board. -It communicates using commands sent over the USB serial pins. +It communicates using commands sent over USB serial. -Commands consist of a single character, followed by up to two arguments. The command is not separated from the first argument, but the first and second argument are separated by a space. - -Request IDs can be specified by prefacing your command with `@int`, for example `@8335`. This is then returned with the command response and can be used to prevent race conditions. +Commands consist of a string terminated by a newline character (\n). +Commands consist of multiple parts seperated by a colon character. ## Commands -| Command | Description | Parameter 1 | Parameter 2 | -|---------|-----------------------------|--------------|------------------------| -| A | Read the analogue pins | | | -| L | Control the debug LED | State {H, L} | | -| R | Read a digital pin | Pin Number | | -| S | Control a servo | Servo Number | Width | -| T | Read a triggered pulse delay| Trigger Pin | Echo Pin | -| U | Read an ultrasound distance | Trigger Pin | Echo Pin | -| V | Get the firmware version | | | -| W | Write to a Pin | Pin Number | Pin State {H, L, P, Z} | +| Command | Description | Parameters | +|-----------------------------------|------------------------------|------------------| +| PIN:\:MODE:GET? | Read pin mode | n = pin number | +| PIN:\:MODE:SET:\ | Set pin mode | n = pin number, value=INPUT/INPUT_PULLUP/OUTPUT| +| PIN:\:DIGITAL:GET? | Digital read pin | n = pin number | +| PIN:\:DIGITAL:SET:\ | Digital write pin | n = pin number, value = 1/0 | +| PIN:\:ANALOG:GET? | Analog read pin | n = pin number | +| ULTRASOUND:\:\:MEASURE?| Measure range from ultrasound| pulse = pulse pin, echo = echo pin | ## Example Commands -Read the analogue pins: `A` - -Turn on the debug LED: `LH` - -Read the ultrasound distance: `U4 5` - -Set pin 6 High: `W6 H` +Set pin mode to input and analog read pin +``` +PIN:14:MODE:SET:INPUT +PIN:14:ANALOG:GET? +``` + +Set pin to output and set it high +``` +PIN:2:MODE:SET:OUTPUT +PIN:2:DIGITAL:SET:1 +```