Punch Through
Published © MIT

Logging data from the Bean

Want to learn how to log data from the Bean using Node-Red? Come and learn with this tutorial!

IntermediateProtip4,628
Logging data from the Bean

Things used in this project

Hardware components

LightBlue Bean
Punch Through LightBlue Bean
×1

Software apps and online services

Punch Through Bean Loader

Story

Read more

Code

Code snippet #1

Plain text
[{"id":"4f7a7d17.b08584","type":"bean","name":"Bean","uuid":"","connectiontype":"constant","connectiontimeout":"0"},{"id":"bf2efb57.40d108","type":"bean serial","name":"","bean":"4f7a7d17.b08584","newline":"\\n","bin":"false","out":"char","addchar":"false","x":190.88888549804688,"y":215.8888931274414,"z":"304506ee.cfbafa","wires":[["ef39c9d6.10c638"]]},{"id":"bd52d5b7.42ad28","type":"file","name":"","filename":"serial-data","appendNewline":true,"overwriteFile":"false","x":705.8889312744141,"y":215.8888931274414,"z":"304506ee.cfbafa","wires":[]},{"id":"ef39c9d6.10c638","type":"function","name":"add timestamp","func":"var d = new Date();\n\nmsg.payload = \n\t{\n\tserial:msg.payload,\n\ttimestamp:d.toTimeString()\n\t}\n\t\nreturn msg;","outputs":"1","x":375.8889923095703,"y":215.8888931274414,"z":"304506ee.cfbafa","wires":[["9a20c44b.65df38"]]},{"id":"9a20c44b.65df38","type":"csv","name":"","sep":",","hdrin":"","hdrout":false,"multi":"one","ret":"\\n","temp":"serial , timestamp","x":553.4445343017578,"y":215.8888931274414,"z":"304506ee.cfbafa","wires":[["bd52d5b7.42ad28"]]}]

Code snippet #2

Plain text
void setup(){
Serial.begin();
}
 
void loop(){
Serial.print("Hi I'm a Bean!");
Serial.print("\n");
Bean.sleep(10000);
}

Credits

Punch Through

Punch Through

16 projects • 41 followers
We’ve been building connected products since 2009. Our diverse team has expertise in every layer from hardware to software to web.

Comments