Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Angel Hunter
Published

Pirate Light Sensor

This tells us whether the light condition is good or bad

IntermediateProtip1 hour72
Pirate Light Sensor

Things used in this project

Hardware components

Magicbit
×1

Software apps and online services

Magicblocks.io

Story

Read more

Schematics

Template [Okay]

Sets as the topic for the display node to show LIGHT OKAY

Timestamp

This repeats the command every 1 second

Analog In

This block sees whether any information is sent through the pins

Switch

Act as a conditional unit

Template [DANGER]

Sets as the topic for the display node to show DANGER

Display

Shows results on an OLED Display

Code

Light Sensor.json

JSON
This is the code for my project
[{"id":"f3bc0a0a.298fe8","type":"tab","label":"My Project","disabled":false,"info":""},{"id":"ab8b0454.d139c8","type":"ui_group","z":"","name":"Out Put","tab":"9d86c141.0cb2e","disp":false,"width":"6","collapse":false},{"id":"9d86c141.0cb2e","type":"ui_tab","z":"","name":"My Project ","icon":"dashboard"},{"id":"2288dcfe.3e0f84","type":"switch","z":"f3bc0a0a.298fe8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"1000","vt":"str"},{"t":"lte","v":"1000","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":660,"wires":[["4e277541.63dcec"],["f5c6c132.dcf6d"]]},{"id":"4e277541.63dcec","type":"template","z":"f3bc0a0a.298fe8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"DANGER!!","output":"str","x":520,"y":620,"wires":[["2879606.bfa3aa"]]},{"id":"f5c6c132.dcf6d","type":"template","z":"f3bc0a0a.298fe8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Light okay","output":"str","x":520,"y":700,"wires":[["2879606.bfa3aa"]]},{"id":"f5a0429c.8db6","type":"inject","z":"f3bc0a0a.298fe8","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":560,"wires":[["17ede1c2.7cafae"]]},{"id":"2879606.bfa3aa","type":"OLED","z":"f3bc0a0a.298fe8","name":"","epId":"id2915-1663849407908","fontSize":"2","x":680,"y":660,"wires":[]},{"id":"17ede1c2.7cafae","type":"AI","z":"f3bc0a0a.298fe8","name":"","epId":"id2915-1663849407908","pin":"36","method":"1","threshold":100,"x":320,"y":560,"wires":[["2288dcfe.3e0f84"]]}]

Credits

Angel Hunter

Angel Hunter

10 projects • 3 followers
I am a student of Zahira College Colombo

Comments