https://github.com/don/arduinobytestream
Read-only Stream from a byte array for Ardunio
https://github.com/don/arduinobytestream
Last synced: over 1 year ago
JSON representation
Read-only Stream from a byte array for Ardunio
- Host: GitHub
- URL: https://github.com/don/arduinobytestream
- Owner: don
- License: other
- Created: 2013-06-26T17:06:39.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-06-27T06:36:25.000Z (almost 13 years ago)
- Last Synced: 2025-01-05T07:45:29.687Z (over 1 year ago)
- Language: Arduino
- Size: 109 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Arduino ByteStream
Read-only Stream from a byte array.
Installing
$ cd ~/Documents/Arduino/libraries
$ git clone https://github.com/don/ArduinoByteStream.git
This is a proof of concept.
See the [tests](tests/test/test.ino) for examples.
Tests
To run the tests, you'll need [ArduinoUnit](https://github.com/mmurdoch/arduinounit). To "install", I clone the repo to my home directory and symlink the source into ~/Documents/Arduino/libraries/ArduinoUnit.
$ cd ~
$ git clone git@github.com:mmurdoch/arduinounit.git
$ cd ~/Documents/Arduino/libraries/
$ ln -s ~/arduinounit/src ArduinoUnit
Once arduinounit is installed, open test.ino in the ArduinoIDE, upload to your Arduino and open the Serial Monitor. You should see a message that all tests have passed.
I use nodejs to create the arrays for the tests.
$ node
> JSON.stringify(Buffer("hello, world"))
'[104,101,108,108,111,44,32,119,111,114,108,100]'
Arduino
byte data[] = { 104,101,108,108,111,44,32,119,111,114,108,100 };
ByteStream stream = ByteStream(data, sizeof(data0);