Skip to content

Commit 33a3875

Browse files
committed
Review comments
1 parent 0dc3f3a commit 33a3875

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

programming/arduino/custom_firmware.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ By default when the `robot` object is created it will try to communicate with al
1717
If you want the API to not try connecting to a device we need to *ignore* the Arduino.
1818

1919
To configure a `Robot` object to ignore a Arduino with custom firmware, you will need to provide it with the Arduino's serial number.
20-
The Arduino serial number is a character string of numbers and letters, and is output in the robot log when you run a program on your robot with your
21-
Arduino connected.
20+
The Arduino serial number is a string of numbers and letters, and is output in the robot log when you run a program on your robot with your Arduino connected.
2221

23-
You'll need the ID later, so it's best to save it into a variable:
22+
You'll need the serial number later, so it's best to save it into a variable:
2423

2524
~~~~~ python
2625
from sr.robot3 import *
@@ -86,6 +85,7 @@ Putting a `b` in front of a string is a short hand way of creating a bytes objec
8685

8786
~~~~~ python
8887
# This will send the message "data" over the serial port
88+
# The b in front of the string is not a typo, this is a byte string
8989
robot.raw_serial_devices[ARDUINO_SN].write(b"data")
9090
~~~~~
9191

programming/arduino/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ title: Arduino API
77

88
The Arduino that came as part of your kit was shipped with a firmware that provides the functionality outlined in the [Arduino API](/docs/programming/arduino/sr_firmware) page.
99
You may wish to use the Arduino as is, extend the functionality of this firmware, or completely replace it.
10+
You can also add your own Arduinos, or other boards, to the kit, running either our firmware or your own.
1011

1112
The `sr.robot3` library provides support for using the Arduino in three possible configurations:
1213

programming/arduino/sr_firmware.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,34 +77,34 @@ robot.arduino.pins[4].mode = INPUT_PULLUP
7777
You can read a **digital** input pin with the following code:
7878

7979
~~~~~ python
80-
# robot.arduinos[ARDUINO_SERIAL_NUMBER].pins[PIN_NO].digital_read()
81-
8280
# to read Arduino's digital pin 3...
83-
pin3 = robot.arduino.pins[3].digital_read()
81+
value = robot.arduino.pins[3].digital_read()
82+
83+
# to read Arduino's digital pin 7...
84+
value = robot.arduino.pins[7].digital_read()
8485
~~~~~
8586

86-
`pin3` will now contain `True` or `False` depending on whether the pin was high (5v) or low (0v), respectively.
87+
`value` will now contain `True` or `False` depending on whether the pin was high (5v) or low (0v), respectively.
8788

8889
You can read an **analog** input pin with the following code:
8990

9091
~~~~~ python
91-
# robot.arduinos[ARDUINO_SERIAL_NUMBER].pins[PIN_NO].analog_read()
92-
9392
# to read Arduino's analog pin A0...
94-
pinA0 = robot.arduino.pins[A0].analog_read()
93+
value = robot.arduino.pins[A0].analog_read()
94+
95+
# to read Arduino's analog pin A4...
96+
value = robot.arduino.pins[A4].analog_read()
9597
~~~~~
9698

9799
The analog pin numbers are available as `A0`, `A1`, `A2`, `A3`, `A4`, and `A5` respectively.
98100

99101

100102
## Output
101103

102-
You can only set digital outputs (there's no analog_write, although feel free to modify the Arduino's firmware to add the ability to output [PWM](https://wikipedia.org/wiki/Pulse-width_modulation "Pulse-width modulation") if you desire).
104+
You can only set digital outputs (there's no analog_write, although feel free to modify the Arduino's firmware to add the ability to output [PWM](https://wikipedia.org/wiki/Pulse-width_modulation) (Pulse-width modulation) if you desire).
103105
To set a digital output pin, you would use the following:
104106

105107
~~~~~ python
106-
# robot.arduinos[ARDUINO_SERIAL_NUMBER].pins[PIN_NO].digital_write(VALUE)
107-
108108
# to set Arduino's pin 2 high:
109109
robot.arduino.pins[2].digital_write(True)
110110

0 commit comments

Comments
 (0)