Last active
July 29, 2016 22:40
Revisions
-
daniellevass revised this gist
Jul 28, 2016 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,8 @@ 3. I had problem trying to get the serial port to read correctly, can’t remember which magical incantation i had to do, but it was on the punchthrough forums, i can go back and look if you need it. > http://beantalk.punchthrough.com/t/heres-how-to-access-bean-serial-data-in-processing/751 this may have been it, but i'm pretty sure the npm package below fixed it too, might be useful if the npm package doesn't work. 4. Arduino Script - you need to make sure the board is setup to be a LightBlue Bean Info on how to get all the values etc are from here - https://punchthrough.com/bean/guides/features/temperature/ -
daniellevass revised this gist
Jul 28, 2016 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,12 @@ #Punch through bean info 1. download the arduino program to write arduino code - https://www.arduino.cc/en/Main/Software 2. download whichever bits on here you need https://punchthrough.com/bean/guides/everything-else/downloads/ 3. I had problem trying to get the serial port to read correctly, can’t remember which magical incantation i had to do, but it was on the punchthrough forums, i can go back and look if you need it. 4. Arduino Script - you need to make sure the board is setup to be a LightBlue Bean Info on how to get all the values etc are from here - https://punchthrough.com/bean/guides/features/temperature/ -
daniellevass created this gist
Jul 28, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,61 @@ #Punch through bean info 4. Arduino Script Info on how to get all the values etc are from here - https://punchthrough.com/bean/guides/features/temperature/ ``` void setup() { Serial.begin(9600); // initialize serial } void loop() { float currTemp = Bean.getTemperature(); Serial.println(currTemp); Bean.sleep(10000); } ``` 5. NodeJS Script (need to install moment + serialport) ```js var serialport = require("serialport"); var SerialPort = serialport.SerialPort; var fs = require('fs'); var moment = require('moment'); var port = new SerialPort('/dev/tty.LightBlue-Bean', { baudrate: 9600, parser: serialport.parsers.readline('\r\n') }); port.on('open', function () { console.log('open!'); }); port.on('error', function (err) { console.log('error ' + err); }); port.on('data', function (data) { console.log('Data: ' + data); var output = "" + moment().toISOString() + "," + data + "\n"; var fileName = moment().format('dddd-DD-MMM'); var filePath = fileName + ".csv" ; fs.appendFile(filePath, output, function(err) { if(err) { return console.log(err); } }); }); ```