Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Implementing the Arduino toolboxThe program structure | ||||||||
Line: 39 to 39 | ||||||||
The Arduino has several 10 bit ADCs on chip which can be used to read analog voltage levels. Here is the command code: Ap: reads the voltage level from analog pin p | ||||||||
Added: | ||||||||
> > | InterruptsNormally interrupts can only be generated on pins 2 and 3 on an Arduino Uno or Nano. However, there are also so-called "PinChangeInterrupts" which allow to hook up an interrupt service routine when a signal level change on a GPIO pin happens. This can be "FALLING" or "RISING" for a falling or rising edge of the signal or it can be "CHANGE" for both edges. Unfortunately there is a problem when using this with the SoftSerial library because both libraries use the same interrupt vectors. Since for our debugging port we only have to send but to not receive message I use the SendonlySoftSerial library attached to this page: https://iotworkshop.africa/pub/Embedded_Systems/ImplementingTheArduinoToolbox/SendOnlySoftwareSerial.zip These are the protocol codes sent to the Arduino: Iacup: a: attach pin p for c: change mode f: falling edge: r: rising edge, u: updown: u: up-counter, d: down-counter c: clearIdp: d: detach from interrupt on pin p Irp: r: read no of counts from interrupt counter EncoderThe rotary encoder also make use of interrupts. It uses 2 signals: clock and data to see when it is turned and in which direction it has been turned. The clock signal is connected to an interrupt and the interrupt service routine, by looking at the data signal, finds out if the encoder was turned clock-wise (a counter increments) of counter-clock-wise (a counter decrements). | |||||||
The multi-function boardIn order to test digital read/write, analog read/write etc. we need an Arduino to which the corresponding hardware is connected, e.g. a switch to be read with digital read, a potentiometer for analog read or an LED for digital write... An easy solution is to use the multi-function board which has all these connections already done and which must simply be installed as a piggy back board onto e.g. an Arduino Uno. | ||||||||
Line: 56 to 72 | ||||||||
https://iotworkshop.africa/pub/Embedded_Systems/ImplementingTheArduinoToolbox/multiFunctionBoard.pdf | ||||||||
Changed: | ||||||||
< < | I use GPIO pin 2 as TX line for a SoftSerial port onto which I send debugging messages. There is a problem when using this with the PinChangeInterrupt library because both libraries use the same interrupt vectors. Since for our debugging port we only have to send but to not receive message I use the SendonlySoftSerial library attached to this page: https://iotworkshop.africa/pub/Embedded_Systems/ImplementingTheArduinoToolbox/SendOnlySoftwareSerial.zip | |||||||
> > | I use GPIO pin 2 as TX line for a SoftSerial port onto which I send debugging messages. | |||||||
The Arduino server program and the test procedureWith this information it is possible to develop the first version of the Arduino server. Since all it needs is input from the serial line we can write a simple C program to test the server. A program asking for the server version (and printing it) as well as the Arduino server are attached to this TWiki page. | ||||||||
Line: 84 to 98 | ||||||||
A tar archive with a Xcos toolbox containing Digital Write as well as as a basic stepper motor xcos block is attached to this page: | ||||||||
Changed: | ||||||||
< < | https://iotworkshop.africa/pub/Embedded_Systems/ImplementingTheArduinoToolbox/arduino-linux_1.5-src-v0.4.tar.gz | |||||||
> > | https://iotworkshop.africa/pub/Embedded_Systems/ImplementingTheArduinoToolbox/arduino-linux_1.6-src-6feb.tar.gz | |||||||
This is the original arduino_1.5-src archive downloaded from git which I modified to run on Linux. Only Digital Write and the stepper motor module are working. The other modules are still part of the archive but will most probably not work. In the original archive the stepper motor block was removed from the Arduino palettes. It has been put back. The original Arduino sketches have been moved into arduino.old and a new server sketch developed which you find in the arduino folder. | ||||||||
Line: 132 to 146 | ||||||||
| ||||||||
Deleted: | ||||||||
< < |
| |||||||
| ||||||||
Added: | ||||||||
> > |
|