Arduino Demo
Posted: Wed Oct 24, 2012 12:22 am
Hi,
Here is a demo for interfacing an Arduino Uno.
I've attached the FlowStone Schematic and the Arduino Sketch.
Here are the details:
This Demo communicates over the serial port, which the Arduino provides over USB. The Protocol runs at 115200 Baud, and is in a raw chunk format. That means, the data is not plain text, and it can transfere anything. The maximum Chunk size is 64Byte, which is the buffer size of the Arduino Hardware Serial Implementation.
The demo demonstrates a polling system, so the Flowstone Schematic as to ask the Arduino, for data. It's not event driven. At the moment there are only 5 commands, that the Arduino-Sketch can Handle:
0x11 HELLO - Just to test if the Sketch is running
0x22 PIN_MODE - Set the Direction of all Pins
0x33 DIGITAL_OUT - Output LOW/HIGH on the Pins that are configured as Outputs
0x44 DIGITAL_IN - Read LOW/HIGH from Pins that are configured as Inputs
0x55 ANALOG_IN - Read 8-Bit ADC values from Pins that are configured as Analog Input
The protocol is very simple to extend. It also supports Error-Reporting, and the FlowStone-Schematic automatically cancels the communication when an error occured.
Some Notices: On this Demo I excluded the pins 0&1, the reason is: These pins are used for the serial communication, changing these would kill the communication with the PC.
On Pin 13 is a yellow LED, that you can toggle. But on some versions, this pin is connected directly. That means there is always a pull down on this pin, and you can't use it as general I/O. You have to be careful with this pin (drive it with enough current when it is an Input, pull less current, when it's an Output)
Have fun,
Maik
Here is a demo for interfacing an Arduino Uno.
I've attached the FlowStone Schematic and the Arduino Sketch.
Here are the details:
This Demo communicates over the serial port, which the Arduino provides over USB. The Protocol runs at 115200 Baud, and is in a raw chunk format. That means, the data is not plain text, and it can transfere anything. The maximum Chunk size is 64Byte, which is the buffer size of the Arduino Hardware Serial Implementation.
The demo demonstrates a polling system, so the Flowstone Schematic as to ask the Arduino, for data. It's not event driven. At the moment there are only 5 commands, that the Arduino-Sketch can Handle:
0x11 HELLO - Just to test if the Sketch is running
0x22 PIN_MODE - Set the Direction of all Pins
0x33 DIGITAL_OUT - Output LOW/HIGH on the Pins that are configured as Outputs
0x44 DIGITAL_IN - Read LOW/HIGH from Pins that are configured as Inputs
0x55 ANALOG_IN - Read 8-Bit ADC values from Pins that are configured as Analog Input
The protocol is very simple to extend. It also supports Error-Reporting, and the FlowStone-Schematic automatically cancels the communication when an error occured.
Some Notices: On this Demo I excluded the pins 0&1, the reason is: These pins are used for the serial communication, changing these would kill the communication with the PC.
On Pin 13 is a yellow LED, that you can toggle. But on some versions, this pin is connected directly. That means there is always a pull down on this pin, and you can't use it as general I/O. You have to be careful with this pin (drive it with enough current when it is an Input, pull less current, when it's an Output)
Have fun,
Maik