├── .gitignore ├── CNAME ├── LICENSE ├── README.md ├── broker ├── broker.go ├── database.go ├── database_test.go ├── go.mod ├── go.sum ├── grammar.peg ├── parser2.go ├── parser2_test.go ├── subscriber.go └── subscriber_test.go ├── docs ├── CNAME ├── basic_desk_setup.jpg ├── bootstrapping.md ├── broker-diagram.png ├── broker.md ├── cards-circuitpy-editor.jpg ├── cards-laser-region.jpg ├── cards-projected-ar.jpg ├── demo-turtlebot-cards.jpg ├── demo-turtlebot.jpg ├── editing-source-code.md ├── growing-a-space.md ├── hello_world_aruco.gif ├── index.html ├── laser-cv-webcam.jpg ├── paper-dot-sensing.png └── rfid-sensing.png ├── experimental ├── QuadGrid.java ├── Room.java ├── ble_proxy.py ├── broker_log_dependency_graphing.py ├── circuitpython_editor.py ├── eink-drawing.html ├── eink-picture.html ├── escpos-print-code.py ├── gamepad-recv.py ├── inkplate10 │ ├── query_time.py │ └── room_image_frame.h ├── mfrc522-itsy-bitsy-2 │ ├── main.py │ ├── mfrc522.mpy │ └── mfrc522.py ├── mfrc522-rpi-pico │ ├── code.py │ └── mfrc522.py ├── mfrc522-trinket │ ├── main.py │ ├── mfrc522.mpy │ └── mfrc522.py ├── mpy-cross ├── node-circuitpy-editor │ ├── circuitPythonEditor.js │ └── public │ │ ├── index.html │ │ ├── lib │ │ ├── ayu-dark.css │ │ ├── codemirror.css │ │ ├── codemirror.js │ │ └── python.js │ │ └── script.js ├── nodegamepad.js ├── processing_graphics.pde ├── progspace_room.mpy ├── progspace_room.py ├── simple-pygame.py ├── sound │ ├── notes.md │ ├── test1.py │ └── test2.py ├── websockets-broker │ ├── client.js │ ├── client.py │ ├── package.json │ └── server.go ├── ws-cv-chain │ ├── cv.py │ ├── source.html │ └── viewer.html └── zeromq_processing.pde ├── jig ├── package-lock.json ├── package.json ├── requirements.txt ├── src ├── files │ ├── Inconsolata-Regular.ttf │ ├── aruco-boot-2021-12-10.jpg │ ├── arucoWebManager │ │ └── index.html │ ├── boot-papers.jpg │ ├── circuitPythonEditor │ │ ├── index.html │ │ ├── lib │ │ │ ├── ayu-dark.css │ │ │ ├── codemirror.css │ │ │ ├── codemirror.js │ │ │ ├── python.js │ │ │ ├── simplescrollbars.css │ │ │ └── simplescrollbars.js │ │ └── script.js │ ├── cv_tiles │ │ ├── down.png │ │ ├── left.png │ │ ├── loopstart.png │ │ ├── loopstop.png │ │ ├── right.png │ │ └── up.png │ ├── dot-codes.txt │ ├── frame-to-papers │ │ └── index.html │ ├── region-editor │ │ ├── index.html │ │ ├── p5.dom.min.js │ │ ├── p5.min.js │ │ ├── sketch.js │ │ └── style.css │ ├── spotify-manager-web-public │ │ └── index.html │ ├── test-paper-dots │ │ ├── 1.jpg │ │ ├── 10.jpg │ │ ├── 11.jpg │ │ ├── 12.jpg │ │ ├── 2.jpg │ │ ├── 3.jpg │ │ ├── 4.jpg │ │ ├── 5.jpg │ │ ├── 6.jpg │ │ ├── 7.jpg │ │ ├── 8.jpg │ │ ├── 9.jpg │ │ └── bad-projection.jpg │ ├── web-debugger │ │ ├── index.html │ │ ├── index.js │ │ └── old │ │ │ ├── index.html │ │ │ └── index.js │ ├── web-display │ │ ├── glfx.js │ │ ├── index.html │ │ └── script.js │ ├── web-editor │ │ └── index.html │ └── web-tablet │ │ ├── aruco-grid-print.html │ │ ├── index.html │ │ ├── index.js │ │ ├── select-program │ │ ├── index.html │ │ └── index.js │ │ ├── thermal-selfie.html │ │ └── to-read.html ├── helpers │ ├── helper.js │ ├── helper.lua │ ├── json.lua │ ├── matrix.lua │ └── zhelpers.lua ├── microcontrollers │ ├── arduino │ │ └── mrfc522-32u4 │ │ │ └── read.ino │ ├── circuit-playground │ │ └── sensor-lights-1.py │ └── particle-photon │ │ ├── blink │ │ └── src │ │ │ └── blink.ino │ │ ├── blooming-flower-controlled │ │ └── blooming-flower-controlled.ino │ │ ├── blooming-flower │ │ └── blooming-flower.ino │ │ ├── color-sensor-log.ino │ │ ├── dht-sensor │ │ ├── Adafruit_DHT.cpp │ │ ├── Adafruit_DHT.h │ │ ├── HttpClient.cpp │ │ ├── HttpClient.h │ │ └── dht-sensor.ino │ │ ├── rc522_test │ │ ├── HttpClient.cpp │ │ ├── HttpClient.h │ │ ├── MFRC522.cpp │ │ ├── MFRC522.h │ │ ├── SparkJson │ │ │ ├── ArduinoJson.h │ │ │ ├── CMakeLists.txt │ │ │ ├── DynamicJsonBuffer.h │ │ │ ├── IndentedPrint.cpp │ │ │ ├── IndentedPrint.h │ │ │ ├── JsonArray.cpp │ │ │ ├── JsonArray.h │ │ │ ├── JsonBuffer.cpp │ │ │ ├── JsonBuffer.h │ │ │ ├── JsonBufferAllocated.h │ │ │ ├── JsonObject.cpp │ │ │ ├── JsonObject.h │ │ │ ├── JsonPair.h │ │ │ ├── JsonParser.cpp │ │ │ ├── JsonParser.h │ │ │ ├── JsonPrintable.h │ │ │ ├── JsonVariant.cpp │ │ │ ├── JsonVariant.h │ │ │ ├── JsonVariantContent.h │ │ │ ├── JsonVariantType.h │ │ │ ├── JsonWriter.h │ │ │ ├── List.cpp │ │ │ ├── List.h │ │ │ ├── ListConstIterator.h │ │ │ ├── ListIterator.h │ │ │ ├── ListNode.h │ │ │ ├── Prettyfier.cpp │ │ │ ├── Prettyfier.h │ │ │ ├── Print.cpp │ │ │ ├── Print.h │ │ │ ├── QuotedString.cpp │ │ │ ├── QuotedString.h │ │ │ ├── ReferenceType.h │ │ │ ├── SparkJson.cpp │ │ │ ├── SparkJson.h │ │ │ ├── StaticJsonBuffer.h │ │ │ ├── StringBuilder.cpp │ │ │ ├── StringBuilder.h │ │ │ ├── examples │ │ │ │ ├── IndentedPrintExample │ │ │ │ │ └── IndentedPrintExample.ino │ │ │ │ ├── JsonGeneratorExample │ │ │ │ │ └── JsonGeneratorExample.ino │ │ │ │ ├── JsonParserExample │ │ │ │ │ └── JsonParserExample.ino │ │ │ │ └── JsonServer │ │ │ │ │ └── JsonServer.ino │ │ │ └── my-core.ino │ │ └── app.ino │ │ ├── rfid-ble-characteristics │ │ ├── .vscode │ │ │ ├── launch.json │ │ │ └── settings.json │ │ ├── README.md │ │ ├── lib │ │ │ ├── HttpClient │ │ │ │ ├── LICENSE │ │ │ │ ├── library.properties │ │ │ │ ├── readme.md │ │ │ │ └── src │ │ │ │ │ ├── HttpClient.cpp │ │ │ │ │ ├── HttpClient.h │ │ │ │ │ └── HttpClient │ │ │ │ │ └── HttpClient.h │ │ │ ├── MFRC522 │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── library.properties │ │ │ │ └── src │ │ │ │ │ ├── MFRC522.cpp │ │ │ │ │ ├── MFRC522.h │ │ │ │ │ └── MFRC522 │ │ │ │ │ └── MFRC522.h │ │ │ └── SparkJson │ │ │ │ ├── LICENSE.md │ │ │ │ ├── README.md │ │ │ │ ├── library.properties │ │ │ │ └── src │ │ │ │ ├── ArduinoJson.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── DynamicJsonBuffer.h │ │ │ │ ├── IndentedPrint.cpp │ │ │ │ ├── IndentedPrint.h │ │ │ │ ├── JsonArray.cpp │ │ │ │ ├── JsonArray.h │ │ │ │ ├── JsonBuffer.cpp │ │ │ │ ├── JsonBuffer.h │ │ │ │ ├── JsonBufferAllocated.h │ │ │ │ ├── JsonObject.cpp │ │ │ │ ├── JsonObject.h │ │ │ │ ├── JsonPair.h │ │ │ │ ├── JsonParser.cpp │ │ │ │ ├── JsonParser.h │ │ │ │ ├── JsonPrintable.h │ │ │ │ ├── JsonVariant.cpp │ │ │ │ ├── JsonVariant.h │ │ │ │ ├── JsonVariantContent.h │ │ │ │ ├── JsonVariantType.h │ │ │ │ ├── JsonWriter.h │ │ │ │ ├── List.cpp │ │ │ │ ├── List.h │ │ │ │ ├── ListConstIterator.h │ │ │ │ ├── ListIterator.h │ │ │ │ ├── ListNode.h │ │ │ │ ├── Prettyfier.cpp │ │ │ │ ├── Prettyfier.h │ │ │ │ ├── Print.cpp │ │ │ │ ├── Print.h │ │ │ │ ├── QuotedString.cpp │ │ │ │ ├── QuotedString.h │ │ │ │ ├── ReferenceType.h │ │ │ │ ├── SparkJson.cpp │ │ │ │ ├── SparkJson.h │ │ │ │ ├── StaticJsonBuffer.h │ │ │ │ ├── StringBuilder.cpp │ │ │ │ └── StringBuilder.h │ │ ├── project.properties │ │ └── src │ │ │ └── rfid-ble-characteristics.ino │ │ ├── rfid-ble │ │ ├── .vscode │ │ │ ├── launch.json │ │ │ └── settings.json │ │ ├── README.md │ │ ├── lib │ │ │ ├── HttpClient │ │ │ │ ├── LICENSE │ │ │ │ ├── library.properties │ │ │ │ ├── readme.md │ │ │ │ └── src │ │ │ │ │ ├── HttpClient.cpp │ │ │ │ │ ├── HttpClient.h │ │ │ │ │ └── HttpClient │ │ │ │ │ └── HttpClient.h │ │ │ ├── MFRC522 │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── library.properties │ │ │ │ └── src │ │ │ │ │ ├── MFRC522.cpp │ │ │ │ │ ├── MFRC522.h │ │ │ │ │ └── MFRC522 │ │ │ │ │ └── MFRC522.h │ │ │ └── SparkJson │ │ │ │ ├── LICENSE.md │ │ │ │ ├── README.md │ │ │ │ ├── library.properties │ │ │ │ └── src │ │ │ │ ├── ArduinoJson.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── DynamicJsonBuffer.h │ │ │ │ ├── IndentedPrint.cpp │ │ │ │ ├── IndentedPrint.h │ │ │ │ ├── JsonArray.cpp │ │ │ │ ├── JsonArray.h │ │ │ │ ├── JsonBuffer.cpp │ │ │ │ ├── JsonBuffer.h │ │ │ │ ├── JsonBufferAllocated.h │ │ │ │ ├── JsonObject.cpp │ │ │ │ ├── JsonObject.h │ │ │ │ ├── JsonPair.h │ │ │ │ ├── JsonParser.cpp │ │ │ │ ├── JsonParser.h │ │ │ │ ├── JsonPrintable.h │ │ │ │ ├── JsonVariant.cpp │ │ │ │ ├── JsonVariant.h │ │ │ │ ├── JsonVariantContent.h │ │ │ │ ├── JsonVariantType.h │ │ │ │ ├── JsonWriter.h │ │ │ │ ├── List.cpp │ │ │ │ ├── List.h │ │ │ │ ├── ListConstIterator.h │ │ │ │ ├── ListIterator.h │ │ │ │ ├── ListNode.h │ │ │ │ ├── Prettyfier.cpp │ │ │ │ ├── Prettyfier.h │ │ │ │ ├── Print.cpp │ │ │ │ ├── Print.h │ │ │ │ ├── QuotedString.cpp │ │ │ │ ├── QuotedString.h │ │ │ │ ├── ReferenceType.h │ │ │ │ ├── SparkJson.cpp │ │ │ │ ├── SparkJson.h │ │ │ │ ├── StaticJsonBuffer.h │ │ │ │ ├── StringBuilder.cpp │ │ │ │ └── StringBuilder.h │ │ ├── project.properties │ │ └── src │ │ │ └── rfid-ble.ino │ │ ├── rfid-eight-sensors │ │ ├── HttpClient.cpp │ │ ├── HttpClient.h │ │ ├── MFRC522.cpp │ │ ├── MFRC522.h │ │ └── code.ino │ │ ├── rfid │ │ ├── .vscode │ │ │ ├── launch.json │ │ │ └── settings.json │ │ ├── README.md │ │ ├── lib │ │ │ ├── HttpClient │ │ │ │ ├── LICENSE │ │ │ │ ├── library.properties │ │ │ │ ├── readme.md │ │ │ │ └── src │ │ │ │ │ ├── HttpClient.cpp │ │ │ │ │ ├── HttpClient.h │ │ │ │ │ └── HttpClient │ │ │ │ │ └── HttpClient.h │ │ │ ├── MFRC522 │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── library.properties │ │ │ │ └── src │ │ │ │ │ ├── MFRC522.cpp │ │ │ │ │ ├── MFRC522.h │ │ │ │ │ └── MFRC522 │ │ │ │ │ └── MFRC522.h │ │ │ └── SparkJson │ │ │ │ ├── LICENSE.md │ │ │ │ ├── README.md │ │ │ │ ├── library.properties │ │ │ │ └── src │ │ │ │ ├── ArduinoJson.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── DynamicJsonBuffer.h │ │ │ │ ├── IndentedPrint.cpp │ │ │ │ ├── IndentedPrint.h │ │ │ │ ├── JsonArray.cpp │ │ │ │ ├── JsonArray.h │ │ │ │ ├── JsonBuffer.cpp │ │ │ │ ├── JsonBuffer.h │ │ │ │ ├── JsonBufferAllocated.h │ │ │ │ ├── JsonObject.cpp │ │ │ │ ├── JsonObject.h │ │ │ │ ├── JsonPair.h │ │ │ │ ├── JsonParser.cpp │ │ │ │ ├── JsonParser.h │ │ │ │ ├── JsonPrintable.h │ │ │ │ ├── JsonVariant.cpp │ │ │ │ ├── JsonVariant.h │ │ │ │ ├── JsonVariantContent.h │ │ │ │ ├── JsonVariantType.h │ │ │ │ ├── JsonWriter.h │ │ │ │ ├── List.cpp │ │ │ │ ├── List.h │ │ │ │ ├── ListConstIterator.h │ │ │ │ ├── ListIterator.h │ │ │ │ ├── ListNode.h │ │ │ │ ├── Prettyfier.cpp │ │ │ │ ├── Prettyfier.h │ │ │ │ ├── Print.cpp │ │ │ │ ├── Print.h │ │ │ │ ├── QuotedString.cpp │ │ │ │ ├── QuotedString.h │ │ │ │ ├── ReferenceType.h │ │ │ │ ├── SparkJson.cpp │ │ │ │ ├── SparkJson.h │ │ │ │ ├── StaticJsonBuffer.h │ │ │ │ ├── StringBuilder.cpp │ │ │ │ └── StringBuilder.h │ │ ├── project.properties │ │ └── src │ │ │ └── rfid.ino │ │ ├── rgb_light_strand │ │ ├── HttpClient.cpp │ │ ├── HttpClient.h │ │ ├── SparkJson │ │ │ ├── ArduinoJson.h │ │ │ ├── CMakeLists.txt │ │ │ ├── DynamicJsonBuffer.h │ │ │ ├── IndentedPrint.cpp │ │ │ ├── IndentedPrint.h │ │ │ ├── JsonArray.cpp │ │ │ ├── JsonArray.h │ │ │ ├── JsonBuffer.cpp │ │ │ ├── JsonBuffer.h │ │ │ ├── JsonBufferAllocated.h │ │ │ ├── JsonObject.cpp │ │ │ ├── JsonObject.h │ │ │ ├── JsonPair.h │ │ │ ├── JsonParser.cpp │ │ │ ├── JsonParser.h │ │ │ ├── JsonPrintable.h │ │ │ ├── JsonVariant.cpp │ │ │ ├── JsonVariant.h │ │ │ ├── JsonVariantContent.h │ │ │ ├── JsonVariantType.h │ │ │ ├── JsonWriter.h │ │ │ ├── List.cpp │ │ │ ├── List.h │ │ │ ├── ListConstIterator.h │ │ │ ├── ListIterator.h │ │ │ ├── ListNode.h │ │ │ ├── Prettyfier.cpp │ │ │ ├── Prettyfier.h │ │ │ ├── Print.cpp │ │ │ ├── Print.h │ │ │ ├── QuotedString.cpp │ │ │ ├── QuotedString.h │ │ │ ├── ReferenceType.h │ │ │ ├── SparkJson.cpp │ │ │ ├── SparkJson.h │ │ │ ├── StaticJsonBuffer.h │ │ │ ├── StringBuilder.cpp │ │ │ ├── StringBuilder.h │ │ │ ├── examples │ │ │ │ ├── IndentedPrintExample │ │ │ │ │ └── IndentedPrintExample.ino │ │ │ │ ├── JsonGeneratorExample │ │ │ │ │ └── JsonGeneratorExample.ino │ │ │ │ ├── JsonParserExample │ │ │ │ │ └── JsonParserExample.ino │ │ │ │ └── JsonServer │ │ │ │ │ └── JsonServer.ino │ │ │ └── my-core.ino │ │ ├── WS2801.cpp │ │ ├── WS2801.h │ │ └── app.ino │ │ ├── ribbon-motor-controlled │ │ └── ribbon-motor-controlled.ino │ │ ├── soil-sensor │ │ ├── Adafruit_seesaw.cpp │ │ ├── Adafruit_seesaw.h │ │ └── soil-sensor.ino │ │ └── temp-sensor1.c ├── processing │ └── graphics │ │ ├── QuadGrid.java │ │ ├── Room.java │ │ ├── code │ │ └── jeromq-0.5.2.jar │ │ ├── data │ │ └── Inconsolata-Regular.ttf │ │ └── graphics.pde └── programs │ ├── 0__boot.js │ ├── 100__serverWatchProcessStart.py │ ├── 1013__textEditor.js │ ├── 1014__webEditor.js │ ├── 1044.js │ ├── 1047.js │ ├── 105__robotCodeRunner.js │ ├── 106__robotCode.py │ ├── 10__debugViewer.js │ ├── 1100__non-boot-facts.js │ ├── 1101__non-boot-facts-2.js │ ├── 1102__listenToAll.js │ ├── 1108.js │ ├── 1108.prejs │ ├── 111__rfidEditorBoot.js │ ├── 112__arucoEditorBoot.js │ ├── 1167.js │ ├── 1167__showWebcamImage.js │ ├── 1174.js │ ├── 1174.prejs │ ├── 1187.js │ ├── 1192__circuitPythonProxy.py │ ├── 1193__bluefruitProxy.js │ ├── 1194__rfidSensorsUSBProxy.py │ ├── 11__latencyMonitor.js │ ├── 1200__test.js │ ├── 1201__test.js │ ├── 1202__test.js │ ├── 1203__test.js │ ├── 1204__test.js │ ├── 1205__test.js │ ├── 1206__test.js │ ├── 1207__test.js │ ├── 1208__test.js │ ├── 1209__test.js │ ├── 1210__test.js │ ├── 122__turtleCardGame.js │ ├── 1244.js │ ├── 1245__weatherForecast.js │ ├── 1246__webDisplay.js │ ├── 1247__webDisplayMasterlist.js │ ├── 1248__webDisplay2.js │ ├── 1259.js │ ├── 1269.js │ ├── 1269.prejs │ ├── 12__regionDebug.js │ ├── 1300__test.py │ ├── 1301__test.py │ ├── 1347.js │ ├── 1347.prejs │ ├── 136.js │ ├── 1382__print-paper.go │ ├── 1400__exp.go │ ├── 141.js │ ├── 1414.js │ ├── 1414.prejs │ ├── 1459__createNewPaper.js │ ├── 1567.js │ ├── 1567.prejs │ ├── 1600__frame-to-dots.py │ ├── 1601__frame-to-papers.go │ ├── 1602__mouseCalibration.py │ ├── 1603__keyboardCalibration.js │ ├── 1606__frame-to-papers-boot.go │ ├── 1610__seeCodeBlocks.py │ ├── 1620__seeLaser.py │ ├── 1621__seeLaserLamp.py │ ├── 1622__seeLaserLamp2.py │ ├── 1625__webProjectorCalibration.js │ ├── 1630__claimFrame.py │ ├── 1631__arucoTagCv.py │ ├── 1632__arucoTagCvBoot.py │ ├── 1635.js │ ├── 1635.prejs │ ├── 1636__arucoWebManager.js │ ├── 1640__seeLightBlobs.py │ ├── 1641__seeLightBlobsDownload.py │ ├── 1650__toggleLightcrafter.py │ ├── 166.js │ ├── 166.prejs │ ├── 1673.js │ ├── 1681.js │ ├── 1700__projectorDisplay.py │ ├── 1701__projectorDisplay.py │ ├── 1702__projectorDisplay.py │ ├── 1703__projectorDisplay.go │ ├── 1720.js │ ├── 1720.prejs │ ├── 1733.py │ ├── 1751.js │ ├── 1760.py │ ├── 1761.py │ ├── 1762.py │ ├── 1763.py │ ├── 1764.py │ ├── 1765.py │ ├── 1766.py │ ├── 1767.py │ ├── 1768.py │ ├── 1769.py │ ├── 1770.py │ ├── 1771.py │ ├── 1772.py │ ├── 1773.py │ ├── 1774.py │ ├── 1775.py │ ├── 1776.py │ ├── 1777.py │ ├── 1778.py │ ├── 1779.py │ ├── 1780.py │ ├── 1800__dots-to-papers.go │ ├── 1803__calendarHelper.js │ ├── 1804__editPaperSeen.js │ ├── 1827.js │ ├── 1850__bleProxyRfid.js │ ├── 1851__bleProxyRfid2.js │ ├── 1852__bleProxy.py │ ├── 1853__bleProxyNoble.js │ ├── 1854__circuitPythonEditor.py │ ├── 1855__thermalPrinterEscpos.py │ ├── 1856__circuitPythonEditor.js │ ├── 1900__processManager.js │ ├── 1901__remoteProcessManager.js │ ├── 1902__remoteStartInit.js │ ├── 1910.js │ ├── 1910.prejs │ ├── 1911.js │ ├── 1911.prejs │ ├── 1912.js │ ├── 1912.prejs │ ├── 1913.js │ ├── 1913.prejs │ ├── 1914.js │ ├── 1914.prejs │ ├── 1915.js │ ├── 1915.prejs │ ├── 1916.js │ ├── 1916.prejs │ ├── 1917.js │ ├── 1917.prejs │ ├── 1918.js │ ├── 1918.prejs │ ├── 1919.js │ ├── 1919.prejs │ ├── 1920.js │ ├── 1920.prejs │ ├── 1968.py │ ├── 1969.py │ ├── 1970.py │ ├── 1971.js │ ├── 1971.prejs │ ├── 1976.js │ ├── 1976.prejs │ ├── 1977.js │ ├── 1977.prejs │ ├── 1978.js │ ├── 1978.prejs │ ├── 1979.js │ ├── 1979.prejs │ ├── 1980.js │ ├── 1980.prejs │ ├── 1981.js │ ├── 1981.prejs │ ├── 1982.js │ ├── 1982.prejs │ ├── 1983.js │ ├── 1983.prejs │ ├── 1984.js │ ├── 1984.prejs │ ├── 1985.js │ ├── 1985.prejs │ ├── 1986.js │ ├── 1986.prejs │ ├── 1987.js │ ├── 1987.prejs │ ├── 1988.js │ ├── 1988.prejs │ ├── 1995__einkGraphics.py │ ├── 1__test.js │ ├── 2000__blank.js │ ├── 2000__blank.prejs │ ├── 2001__blank.js │ ├── 2001__blank.prejs │ ├── 2002__blank.js │ ├── 2002__blank.prejs │ ├── 2003__blank.js │ ├── 2003__blank.prejs │ ├── 2004__blank.js │ ├── 2004__blank.prejs │ ├── 2005__blank.js │ ├── 2005__blank.prejs │ ├── 2006__blank.js │ ├── 2006__blank.prejs │ ├── 2007__blank.js │ ├── 2007__blank.prejs │ ├── 2008__blank.js │ ├── 2008__blank.prejs │ ├── 2009__blank.js │ ├── 2009__blank.prejs │ ├── 2010__blank.js │ ├── 2010__blank.prejs │ ├── 2011__blank.js │ ├── 2011__blank.prejs │ ├── 2012__blank.js │ ├── 2012__blank.prejs │ ├── 2013__blank.js │ ├── 2013__blank.prejs │ ├── 2014__blank.js │ ├── 2014__blank.prejs │ ├── 2015__blank.js │ ├── 2015__blank.prejs │ ├── 2016__blank.js │ ├── 2016__blank.prejs │ ├── 2017__blank.js │ ├── 2017__blank.prejs │ ├── 2018__blank.js │ ├── 2018__blank.prejs │ ├── 2019__blank.js │ ├── 2019__blank.prejs │ ├── 2020__blank.js │ ├── 2020__blank.prejs │ ├── 2021__blank.js │ ├── 2021__blank.prejs │ ├── 2022__blank.js │ ├── 2022__blank.prejs │ ├── 2023__blank.js │ ├── 2023__blank.prejs │ ├── 2024.js │ ├── 2024.prejs │ ├── 2025.js │ ├── 2025.prejs │ ├── 2026.js │ ├── 2026.prejs │ ├── 2027.js │ ├── 2027.prejs │ ├── 2028__darksky.js │ ├── 2028__darksky.prejs │ ├── 2029.js │ ├── 2029.prejs │ ├── 2030.js │ ├── 2030.prejs │ ├── 2031.js │ ├── 2031.prejs │ ├── 2032.js │ ├── 2033.js │ ├── 2033.prejs │ ├── 2034.js │ ├── 2034.prejs │ ├── 2035.js │ ├── 2035.prejs │ ├── 2036.js │ ├── 2036.prejs │ ├── 2037.js │ ├── 2037.prejs │ ├── 2038.js │ ├── 2038.prejs │ ├── 2039.js │ ├── 2039.prejs │ ├── 2040.js │ ├── 2040.prejs │ ├── 2041.js │ ├── 2041.prejs │ ├── 2042.js │ ├── 2042.prejs │ ├── 2043.js │ ├── 2043.prejs │ ├── 2044.js │ ├── 2044.prejs │ ├── 20__httpClient.js │ ├── 210.js │ ├── 210.prejs │ ├── 231.js │ ├── 232.py │ ├── 275.js │ ├── 277__pointingAt.py │ ├── 280__makeLaserRegion.py │ ├── 281__laserInRegion.py │ ├── 282__toggleRegion.py │ ├── 283__highlightRegions.py │ ├── 284__laserInCalendar.py │ ├── 285__makeLaserRegion2.py │ ├── 286__regionCalibrationAdapter.py │ ├── 287__screenRegionCalibration.py │ ├── 2__test.js │ ├── 30__rfidPaperMap.js │ ├── 30__rfidPaperMap.prejs │ ├── 310__spotifyManager.js │ ├── 33__tablet-humidity.js │ ├── 34__tablet-color.js │ ├── 35__strand-light-color.js │ ├── 390__initialProgramCode.js │ ├── 391__laserInPaper.py │ ├── 392__highlightLaser.py │ ├── 395__taco.js │ ├── 399__showImage.js │ ├── 3__test.js │ ├── 401__subFrameAnimation.py │ ├── 40__parser.js │ ├── 419.js │ ├── 419.prejs │ ├── 430__mapDrawPaperToDisplay.py │ ├── 431__arucoDial.py │ ├── 45__runSeenRFID.js │ ├── 45__runSeenRFID.prejs │ ├── 46__photonFlasher.js │ ├── 472__highlightPapers.js │ ├── 47__proxyParticleSoilData.js │ ├── 48__proxyFlowerLamp.js │ ├── 498__printingManager.py │ ├── 49__proxyStringMotor.js │ ├── 502.js │ ├── 502.prejs │ ├── 505.js │ ├── 50__proxy.py │ ├── 51__proxy.py │ ├── 52__proxyRobot.py │ ├── 53__tileProxy.py │ ├── 54__laserProxy.py │ ├── 55__frameProxy.py │ ├── 56__rpiDisplayProxy.py │ ├── 577__programEditor.js │ ├── 57__editorToServerProxy.py │ ├── 58__serverToEditorProxy.py │ ├── 597.js │ ├── 5__test.py │ ├── 609.js │ ├── 609.prejs │ ├── 620__paperDetails.js │ ├── 631.js │ ├── 631.prejs │ ├── 647__keyboard.py │ ├── 648__keyboard.py │ ├── 649__keyboard.py │ ├── 650__keyboard.py │ ├── 676.js │ ├── 676.prejs │ ├── 6__graphics-test.js │ ├── 716__logReader.js │ ├── 759.js │ ├── 760.js │ ├── 770__melody1.js │ ├── 771__change-bpm-1.js │ ├── 772__change-bpm-2.js │ ├── 773__change-instrument-1.js │ ├── 774__change-instrument-2.js │ ├── 775__change-melody-1.js │ ├── 776__change-melody-2.js │ ├── 777__soundPlayer.py │ ├── 778__bpm-by-rotation.js │ ├── 790__thermalPrinter.py │ ├── 791__thermalPrinterLinux.py │ ├── 792__deepspeech.py │ ├── 793__textToSpeech.js │ ├── 795.js │ ├── 795.prejs │ ├── 7__graphics-test.py │ ├── 809.js │ ├── 810__notionReadingDatabase.js │ ├── 826__runSeenPapers.js │ ├── 8__blank.js │ ├── 909__laserSocksReferee.js │ ├── 910__laserSocksScoreboard.py │ ├── 911__laserRegionToLaserCal.js │ ├── 912__highlightAllRegions.py │ ├── 958.js │ ├── 958.prejs │ ├── 980__thermalPrintCode.js │ ├── 989__persistProjectorCalibration.js │ ├── 993.js │ ├── go-cv_test.go │ ├── graphics.lua │ ├── graphics.py │ ├── helper.py │ └── logs │ └── .keep └── util ├── anybeamrpicam.desktop ├── ble-rfid.service ├── deepspeech.service ├── einkdisplay.service ├── lamp.desktop ├── lightcrafter.desktop ├── lightcrafter.service ├── ngrok └── rfideditorstart2.conf ├── pidisplay.desktop ├── pidisplay.service ├── progspace.service ├── remoteprogspace.service ├── remotestart.desktop ├── text-to-speech.service └── thermal-printer.service /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | .py[co] 4 | __pycache__ 5 | .log 6 | src/files/*.pdf 7 | !src/programs/logs/.keep 8 | src/programs/logs/ 9 | src/lua-bundle 10 | *.bin 11 | broker/db_view*.txt 12 | broker/broker 13 | broker/broker.log 14 | src/microcontrollers/particle-photon/*/target 15 | build/config.gypi 16 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | programmable.space -------------------------------------------------------------------------------- /broker/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/jhaip/programmable-space 2 | 3 | go 1.12 4 | 5 | require ( 6 | github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 7 | github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect 8 | github.com/gorilla/websocket v1.4.2 9 | // github.com/mattn/go-ciede2000 v0.0.0-20170301095244-782e8c62fec3 10 | github.com/jkl1337/go-chromath v0.0.0-20140428033135-240283655afd 11 | github.com/jung-kurt/gofpdf v1.5.2 12 | github.com/kokardy/listing v0.0.0-20140516154625-795534c33c5a 13 | github.com/mattn/go-sqlite3 v1.10.0 14 | github.com/opentracing/opentracing-go v1.1.0 15 | github.com/stretchr/testify v1.3.0 // indirect 16 | github.com/uber-go/atomic v1.4.0 // indirect 17 | github.com/uber/jaeger-client-go v2.16.0+incompatible 18 | github.com/uber/jaeger-lib v2.0.0+incompatible // indirect 19 | go.uber.org/atomic v1.4.0 // indirect 20 | go.uber.org/multierr v1.1.0 // indirect 21 | go.uber.org/zap v1.10.0 22 | ) 23 | -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | programmable.space -------------------------------------------------------------------------------- /docs/basic_desk_setup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/basic_desk_setup.jpg -------------------------------------------------------------------------------- /docs/broker-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/broker-diagram.png -------------------------------------------------------------------------------- /docs/cards-circuitpy-editor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/cards-circuitpy-editor.jpg -------------------------------------------------------------------------------- /docs/cards-laser-region.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/cards-laser-region.jpg -------------------------------------------------------------------------------- /docs/cards-projected-ar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/cards-projected-ar.jpg -------------------------------------------------------------------------------- /docs/demo-turtlebot-cards.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/demo-turtlebot-cards.jpg -------------------------------------------------------------------------------- /docs/demo-turtlebot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/demo-turtlebot.jpg -------------------------------------------------------------------------------- /docs/hello_world_aruco.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/hello_world_aruco.gif -------------------------------------------------------------------------------- /docs/laser-cv-webcam.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/laser-cv-webcam.jpg -------------------------------------------------------------------------------- /docs/paper-dot-sensing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/paper-dot-sensing.png -------------------------------------------------------------------------------- /docs/rfid-sensing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/docs/rfid-sensing.png -------------------------------------------------------------------------------- /experimental/gamepad-recv.py: -------------------------------------------------------------------------------- 1 | """Simple example showing how to get gamepad events.""" 2 | 3 | from __future__ import print_function 4 | 5 | 6 | from inputs import get_gamepad 7 | from inputs import devices 8 | 9 | 10 | def main(): 11 | """Just print out some event infomation when the gamepad is used.""" 12 | print("We have detected the following devices:\n") 13 | 14 | for device in devices: 15 | print(device) 16 | 17 | while 1: 18 | events = get_gamepad() 19 | for event in events: 20 | print(event.ev_type, event.code, event.state) 21 | 22 | 23 | if __name__ == "__main__": 24 | main() 25 | 26 | -------------------------------------------------------------------------------- /experimental/mfrc522-itsy-bitsy-2/mfrc522.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/experimental/mfrc522-itsy-bitsy-2/mfrc522.mpy -------------------------------------------------------------------------------- /experimental/mfrc522-trinket/mfrc522.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/experimental/mfrc522-trinket/mfrc522.mpy -------------------------------------------------------------------------------- /experimental/mpy-cross: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/experimental/mpy-cross -------------------------------------------------------------------------------- /experimental/progspace_room.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/experimental/progspace_room.mpy -------------------------------------------------------------------------------- /experimental/simple-pygame.py: -------------------------------------------------------------------------------- 1 | # Simple pygame program 2 | 3 | # Import and initialize the pygame library 4 | import pygame 5 | pygame.init() 6 | 7 | # Set up the drawing window 8 | screen = pygame.display.set_mode([500, 500]) 9 | 10 | # Run until the user asks to quit 11 | running = True 12 | while running: 13 | 14 | # Did the user click the window close button? 15 | for event in pygame.event.get(): 16 | print(event.type) 17 | if event.type == pygame.QUIT: 18 | running = False 19 | 20 | # Fill the background with white 21 | screen.fill((255, 255, 255)) 22 | 23 | # Draw a solid blue circle in the center 24 | pygame.draw.circle(screen, (0, 0, 255), (250, 250), 75) 25 | 26 | # Flip the display 27 | pygame.display.flip() 28 | 29 | # Done! Time to quit. 30 | pygame.quit() 31 | 32 | -------------------------------------------------------------------------------- /experimental/sound/notes.md: -------------------------------------------------------------------------------- 1 | ## Dependencies: 2 | 3 | - pygame 4 | 5 | ## Install pygame 6 | 7 | https://www.pygame.org/wiki/GettingStarted 8 | 9 | `pip3 install -U pygame --user` 10 | 11 | ## pygame MIDI reference: 12 | 13 | https://www.pygame.org/docs/ref/midi.html 14 | 15 | ## Testing pygame MIDI 16 | 17 | `python3 -m pygame.examples.midi` 18 | 19 | It gives you a keyboard 20 | 21 | ## MacOS issues 22 | 23 | MacOS doesn't have a software MIDI output by default so it needs to be installed: 24 | 25 | SimpleSynth seemed to work: http://notahat.com/simplesynth/ 26 | -------------------------------------------------------------------------------- /experimental/sound/test1.py: -------------------------------------------------------------------------------- 1 | import pygame.midi 2 | import time 3 | 4 | pygame.midi.init() 5 | player = pygame.midi.Output(0) 6 | player.set_instrument(0) 7 | player.note_on(64, 127) 8 | time.sleep(1) 9 | player.note_off(64, 127) 10 | del player 11 | pygame.midi.quit() 12 | -------------------------------------------------------------------------------- /experimental/websockets-broker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "websockets-broker", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "client.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "websocket": "^1.0.34" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /experimental/websockets-broker/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "log" 6 | "net/http" 7 | 8 | "github.com/gorilla/websocket" 9 | ) 10 | 11 | var addr = flag.String("addr", "localhost:8080", "http service address") 12 | 13 | var upgrader = websocket.Upgrader{} // use default options 14 | 15 | func echo(w http.ResponseWriter, r *http.Request) { 16 | c, err := upgrader.Upgrade(w, r, nil) 17 | if err != nil { 18 | log.Print("upgrade:", err) 19 | return 20 | } 21 | defer c.Close() 22 | for { 23 | mt, message, err := c.ReadMessage() 24 | if err != nil { 25 | log.Println("read:", err) 26 | break 27 | } 28 | // log.Printf("recv: %s", message) 29 | err = c.WriteMessage(mt, message) 30 | if err != nil { 31 | log.Println("write:", err) 32 | break 33 | } 34 | } 35 | } 36 | 37 | func main() { 38 | flag.Parse() 39 | log.SetFlags(0) 40 | http.HandleFunc("/echo", echo) 41 | log.Fatal(http.ListenAndServe(*addr, nil)) 42 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.0.0", 3 | "description": "node.js programs in a programmable space", 4 | "repository": "https://github.com/jhaip/programmable-space", 5 | "author": "Jacob Haip", 6 | "license": "MIT", 7 | "engines": { 8 | "node": ">=10.1.0" 9 | }, 10 | "dependencies": { 11 | "@abandonware/noble": "^1.9.2-5", 12 | "@serialport/parser-readline": "^9.0.7", 13 | "body-parser": "^1.18.3", 14 | "canvas": "^2.7.0", 15 | "cookie-parser": "1.3.2", 16 | "cors": "^2.8.4", 17 | "express": "^4.17.1", 18 | "express-ws": "^4.0.0", 19 | "gamepad": "^1.6.0", 20 | "multer": "^1.4.2", 21 | "particle-api-js": "^7.4.0", 22 | "perspective-transform": "^1.1.3", 23 | "pkill": "2.0.0", 24 | "querystring": "~0.2.0", 25 | "request": "^2.88.0", 26 | "serialport": "^9.0.7", 27 | "udev": "^0.6.0", 28 | "uuid": "^3.3.2", 29 | "websocket": "^1.0.34", 30 | "ws": "^7.4.6" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | imutils==0.5.0 2 | requests==2.20.0 3 | # opencv-python~=3.4 4 | opencv-contrib-python~=3.4 5 | # opencv-contrib-python==3.4.4.19 6 | # pygame==1.9.5 7 | # wxPython>=4.0.3 8 | keyboard==0.13.3 9 | pyserial==3.4 10 | adafruit-circuitpython-thermal-printer==1.1.4 11 | websocket-client==1.2.1 12 | -------------------------------------------------------------------------------- /src/files/Inconsolata-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/Inconsolata-Regular.ttf -------------------------------------------------------------------------------- /src/files/aruco-boot-2021-12-10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/aruco-boot-2021-12-10.jpg -------------------------------------------------------------------------------- /src/files/boot-papers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/boot-papers.jpg -------------------------------------------------------------------------------- /src/files/cv_tiles/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/cv_tiles/down.png -------------------------------------------------------------------------------- /src/files/cv_tiles/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/cv_tiles/left.png -------------------------------------------------------------------------------- /src/files/cv_tiles/loopstart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/cv_tiles/loopstart.png -------------------------------------------------------------------------------- /src/files/cv_tiles/loopstop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/cv_tiles/loopstop.png -------------------------------------------------------------------------------- /src/files/cv_tiles/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/cv_tiles/right.png -------------------------------------------------------------------------------- /src/files/cv_tiles/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/cv_tiles/up.png -------------------------------------------------------------------------------- /src/files/region-editor/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/files/region-editor/style.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | overflow: hidden; 3 | margin: 0; 4 | padding: 0; 5 | } 6 | 7 | .parent { 8 | display: flex; 9 | flex-direction: row; 10 | flex-wrap: nowrap; 11 | margin-bottom: 2rem; 12 | } 13 | 14 | small, strong { 15 | display: block; 16 | } 17 | 18 | .left-col { 19 | margin-left: 1rem; 20 | line-height: 1.5rem; 21 | } 22 | 23 | .new-region { 24 | padding: 1rem; 25 | background-color: rgb(182, 255, 182); 26 | margin-bottom: 1rem; 27 | } 28 | 29 | .continue-button { 30 | padding: 10px; 31 | } 32 | -------------------------------------------------------------------------------- /src/files/test-paper-dots/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/1.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/10.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/11.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/12.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/2.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/3.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/4.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/5.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/6.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/7.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/8.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/9.jpg -------------------------------------------------------------------------------- /src/files/test-paper-dots/bad-projection.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/files/test-paper-dots/bad-projection.jpg -------------------------------------------------------------------------------- /src/files/web-display/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Web Display 5 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/files/web-tablet/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | title 7 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/files/web-tablet/select-program/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | title 7 | 17 | 18 | 19 | 20 | Editing 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/files/web-tablet/select-program/index.js: -------------------------------------------------------------------------------- 1 | const BASE_ID = 2000; 2 | const N = 10; 3 | 4 | for (var i = BASE_ID; i < BASE_ID + N; i += 1) { 5 | $("select").append(``) 6 | } 7 | 8 | function claimNewEditTarget(editTargetId) { 9 | $.ajax({ 10 | type: "POST", 11 | url: "/cleanup-claim", 12 | data: { 13 | claim: `paper 1013 is pointing at paper ${editTargetId}`, 14 | retract: `$ paper 1013 is pointing at paper $` 15 | }, 16 | success: function () { console.log("success") }, 17 | failure: function (errMsg) { console.log(errMsg) } 18 | }); 19 | } 20 | 21 | $('select').on('change', function () { 22 | claimNewEditTarget(this.value); 23 | }); 24 | 25 | claimNewEditTarget(BASE_ID); -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/blink/src/blink.ino: -------------------------------------------------------------------------------- 1 | int led1 = D7; 2 | 3 | void setup() { 4 | pinMode(led1, OUTPUT); 5 | } 6 | 7 | void loop() { 8 | digitalWrite(led1, HIGH); 9 | delay(200); 10 | digitalWrite(led1, LOW); 11 | delay(200); 12 | } 13 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "./DynamicJsonBuffer.h" 8 | #include "./JsonArray.h" 9 | #include "./JsonObject.h" 10 | #include "./StaticJsonBuffer.h" 11 | 12 | using namespace ArduinoJson; 13 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/IndentedPrint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "IndentedPrint.h" 8 | 9 | using namespace ArduinoJson::Internals; 10 | 11 | size_t IndentedPrint::write(uint8_t c) { 12 | size_t n = 0; 13 | 14 | if (isNewLine) n += writeTabs(); 15 | 16 | n += sink->write(c); 17 | 18 | isNewLine = c == '\n'; 19 | 20 | return n; 21 | } 22 | 23 | inline size_t IndentedPrint::writeTabs() { 24 | size_t n = 0; 25 | 26 | for (int i = 0; i < level * tabSize; i++) n += sink->write(' '); 27 | 28 | return n; 29 | } 30 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/JsonBufferAllocated.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonBuffer.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | class JsonBufferAllocated { 15 | public: 16 | void *operator new(size_t n, JsonBuffer *jsonBuffer) throw() { 17 | return jsonBuffer->alloc(n); 18 | } 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/JsonPair.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonVariant.h" 10 | 11 | namespace ArduinoJson { 12 | 13 | // A key value pair for JsonObject. 14 | struct JsonPair { 15 | const char* key; 16 | JsonVariant value; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/JsonVariantContent.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | namespace ArduinoJson { 10 | 11 | // Forward declarations 12 | class JsonArray; 13 | class JsonObject; 14 | 15 | namespace Internals { 16 | 17 | // A union that defines the actual content of a JsonVariant. 18 | // The enum JsonVariantType determines which member is in use. 19 | union JsonVariantContent { 20 | bool asBoolean; 21 | double asDouble; // asDouble is also used for float 22 | long asLong; // asLong is also used for char, short and int 23 | const char* asString; // asString can be null 24 | JsonArray* asArray; // asArray cannot be null 25 | JsonObject* asObject; // asObject cannot be null 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/ListNode.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include // for NULL 10 | 11 | #include "JsonBufferAllocated.h" 12 | 13 | namespace ArduinoJson { 14 | namespace Internals { 15 | 16 | // A node for a singly-linked list. 17 | // Used by List and its iterators. 18 | template 19 | struct ListNode : public Internals::JsonBufferAllocated { 20 | ListNode() : next(NULL) {} 21 | 22 | ListNode *next; 23 | T content; 24 | }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/Print.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #ifndef SPARK 8 | 9 | #include "Print.h" 10 | 11 | #include // for sprintf 12 | 13 | size_t Print::print(const char s[]) { 14 | size_t n = 0; 15 | while (*s) { 16 | n += write(*s++); 17 | } 18 | return n; 19 | } 20 | 21 | size_t Print::print(double value, int digits) { 22 | char tmp[32]; 23 | sprintf(tmp, "%.*f", digits, value); 24 | return print(tmp); 25 | } 26 | 27 | size_t Print::print(long value) { 28 | char tmp[32]; 29 | sprintf(tmp, "%ld", value); 30 | return print(tmp); 31 | } 32 | 33 | size_t Print::println() { return write('\r') + write('\n'); } 34 | 35 | #endif -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/Print.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef SPARK 4 | 5 | #include 6 | #include 7 | 8 | // This class reproduces Arduino's Print 9 | class Print { 10 | public: 11 | virtual ~Print() {} 12 | 13 | virtual size_t write(uint8_t) = 0; 14 | 15 | size_t print(const char[]); 16 | size_t print(double, int = 2); 17 | size_t print(long); 18 | size_t println(); 19 | }; 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/QuotedString.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "Print.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | // An helper class to print and extract doubly-quoted strings 15 | class QuotedString { 16 | public: 17 | // Writes a doubly-quote string to a Print implementation. 18 | // It adds the double quotes (") at the beginning and the end of the string. 19 | // It escapes the special characters as required by the JSON specifications. 20 | static size_t printTo(const char *, Print &); 21 | 22 | // Reads a doubly-quoted string from a buffer. 23 | // It removes the double quotes ("). 24 | // It unescapes the special character as required by the JSON specification, 25 | // with the exception of the Unicode characters (\u0000). 26 | static char *extractFrom(char *input, char **end); 27 | }; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/ReferenceType.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | // A type that is meant to be used by reference only (JsonArray and JsonObject) 13 | class ReferenceType { 14 | public: 15 | bool operator==(const ReferenceType& other) const { 16 | // two JsonArray are equal if they are the same instance 17 | // (we don't compare the content) 18 | return this == &other; 19 | } 20 | 21 | bool operator!=(const ReferenceType& other) const { return this != &other; } 22 | 23 | protected: 24 | ReferenceType() {} 25 | 26 | private: 27 | // copy constructor is private 28 | ReferenceType(const ReferenceType&); 29 | 30 | // copy operator is private 31 | ReferenceType& operator=(const ReferenceType&); 32 | }; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/SparkJson.cpp: -------------------------------------------------------------------------------- 1 | #include "SparkJson.h" 2 | 3 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/SparkJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | // About this file 8 | // --------------- 9 | // This file is here to please the Arduino IDE. It must be present in the src/ 10 | // for the IDE to find it. Feel free to ignore this file if your working in 11 | // another environment 12 | 13 | #include "./ArduinoJson.h" 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/StaticJsonBuffer.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonBuffer.h" 10 | 11 | namespace ArduinoJson { 12 | 13 | // Implements a JsonBuffer with fixed memory allocation. 14 | // The template paramenter CAPACITY specifies the capacity of the buffer in 15 | // bytes. 16 | template 17 | class StaticJsonBuffer : public JsonBuffer { 18 | public: 19 | explicit StaticJsonBuffer() : _size(0) {} 20 | 21 | size_t capacity() const { return CAPACITY; } 22 | size_t size() const { return _size; } 23 | 24 | protected: 25 | virtual void* alloc(size_t bytes) { 26 | if (_size + bytes > CAPACITY) return NULL; 27 | void* p = &_buffer[_size]; 28 | _size += bytes; 29 | return p; 30 | } 31 | 32 | private: 33 | uint8_t _buffer[CAPACITY]; 34 | size_t _size; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/StringBuilder.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "StringBuilder.h" 8 | 9 | using namespace ArduinoJson::Internals; 10 | 11 | size_t StringBuilder::write(uint8_t c) { 12 | if (length >= capacity) return 0; 13 | 14 | buffer[length++] = c; 15 | buffer[length] = '\0'; 16 | return 1; 17 | } 18 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/StringBuilder.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "Print.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | // A Print implementation that allows to write in a char[] 15 | class StringBuilder : public Print { 16 | public: 17 | StringBuilder(char *buf, int size) 18 | : buffer(buf), capacity(size - 1), length(0) { 19 | buffer[0] = '\0'; 20 | } 21 | 22 | virtual size_t write(uint8_t c); 23 | 24 | private: 25 | char *buffer; 26 | int capacity; 27 | int length; 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/examples/IndentedPrintExample/IndentedPrintExample.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Arduino JSON library - IndentedPrint example 3 | * Benoit Blanchon 2014 - MIT License 4 | */ 5 | 6 | #include 7 | 8 | using namespace ArduinoJson::Internals; 9 | 10 | void setup() { 11 | Serial.begin(9600); 12 | 13 | IndentedPrint serial(Serial); 14 | serial.setTabSize(4); 15 | 16 | serial.println("This is at indentation 0"); 17 | serial.indent(); 18 | serial.println("This is at indentation 1"); 19 | serial.println("This is also at indentation 1"); 20 | serial.indent(); 21 | serial.println("This is at indentation 2"); 22 | 23 | serial.unindent(); 24 | serial.unindent(); 25 | serial.println("This is back at indentation 0"); 26 | } 27 | 28 | void loop() { 29 | // not used in this example 30 | } -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rc522_test/SparkJson/my-core.ino: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "SparkJson.h" 8 | 9 | void setup() { 10 | Serial.begin(9600); 11 | 12 | StaticJsonBuffer<200> jsonBuffer; 13 | 14 | char json[] = 15 | "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; 16 | 17 | JsonObject& root = jsonBuffer.parseObject(json); 18 | 19 | if (!root.success()) { 20 | Serial.println("parseObject() failed"); 21 | return; 22 | } 23 | 24 | const char* sensor = root["sensor"]; 25 | long time = root["time"]; 26 | double latitude = root["data"][0]; 27 | double longitude = root["data"][1]; 28 | 29 | Serial.println(sensor); 30 | Serial.println(time); 31 | Serial.println(latitude, 6); 32 | Serial.println(longitude, 6); 33 | } 34 | 35 | void loop() { 36 | // not used in this example 37 | } -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensions.ignoreRecommendations": true, 3 | "C_Cpp.default.configurationProvider": "particle.particle-vscode-core", 4 | "files.associations": { 5 | "*.ino": "cpp" 6 | }, 7 | "particle.targetDevice": "argon_bobcat" 8 | } -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/HttpClient/library.properties: -------------------------------------------------------------------------------- 1 | name=HttpClient 2 | version=0.0.5 3 | license=MIT 4 | author=Nils Mattisson 5 | sentence=A work in progress Http Client Library for the Spark Core and Arduino. 6 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/HttpClient/src/HttpClient/HttpClient.h: -------------------------------------------------------------------------------- 1 | #include "../HttpClient.h" -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/MFRC522/LICENSE: -------------------------------------------------------------------------------- 1 | * Based on code Dr.Leong ( WWW.B2CQSHOP.COM ) 2 | * Created by Miguel Balboa (circuitito.com), Jan, 2012. 3 | * Rewritten by Søren Thing Andersen (access.thing.dk), fall of 2013 (Translation to English, refactored, comments, anti collision, cascade levels.) 4 | * Released into the public domain. -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/MFRC522/library.properties: -------------------------------------------------------------------------------- 1 | name=MFRC522 2 | version=0.1.4 3 | license=Unknown 4 | author=Paul Kourany 5 | sentence=MFRC522 RFID library for Particle devices 6 | url=https://github.com/pkourany/MFRC522_RFID_Library 7 | repository=https://github.com/pkourany/MFRC522_RFID_Library.git -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/MFRC522/src/MFRC522/MFRC522.h: -------------------------------------------------------------------------------- 1 | #include "../MFRC522.h" -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/library.properties: -------------------------------------------------------------------------------- 1 | name=SparkJson 2 | version=0.0.2 3 | license=Choose a license 4 | author=bblanchon 5 | sentence=JSON library Ported from @bblanchon 6 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "./DynamicJsonBuffer.h" 8 | #include "./JsonArray.h" 9 | #include "./JsonObject.h" 10 | #include "./StaticJsonBuffer.h" 11 | 12 | using namespace ArduinoJson; 13 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/IndentedPrint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "IndentedPrint.h" 8 | 9 | using namespace ArduinoJson::Internals; 10 | 11 | size_t IndentedPrint::write(uint8_t c) { 12 | size_t n = 0; 13 | 14 | if (isNewLine) n += writeTabs(); 15 | 16 | n += sink->write(c); 17 | 18 | isNewLine = c == '\n'; 19 | 20 | return n; 21 | } 22 | 23 | inline size_t IndentedPrint::writeTabs() { 24 | size_t n = 0; 25 | 26 | for (int i = 0; i < level * tabSize; i++) n += sink->write(' '); 27 | 28 | return n; 29 | } 30 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/JsonBufferAllocated.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonBuffer.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | class JsonBufferAllocated { 15 | public: 16 | void *operator new(size_t n, JsonBuffer *jsonBuffer) throw() { 17 | return jsonBuffer->alloc(n); 18 | } 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/JsonPair.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonVariant.h" 10 | 11 | namespace ArduinoJson { 12 | 13 | // A key value pair for JsonObject. 14 | struct JsonPair { 15 | const char* key; 16 | JsonVariant value; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/JsonVariantContent.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | namespace ArduinoJson { 10 | 11 | // Forward declarations 12 | class JsonArray; 13 | class JsonObject; 14 | 15 | namespace Internals { 16 | 17 | // A union that defines the actual content of a JsonVariant. 18 | // The enum JsonVariantType determines which member is in use. 19 | union JsonVariantContent { 20 | bool asBoolean; 21 | double asDouble; // asDouble is also used for float 22 | long asLong; // asLong is also used for char, short and int 23 | const char* asString; // asString can be null 24 | JsonArray* asArray; // asArray cannot be null 25 | JsonObject* asObject; // asObject cannot be null 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/ListNode.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include // for NULL 10 | 11 | #include "JsonBufferAllocated.h" 12 | 13 | namespace ArduinoJson { 14 | namespace Internals { 15 | 16 | // A node for a singly-linked list. 17 | // Used by List and its iterators. 18 | template 19 | struct ListNode : public Internals::JsonBufferAllocated { 20 | ListNode() : next(NULL) {} 21 | 22 | ListNode *next; 23 | T content; 24 | }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/Print.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #ifndef SPARK 8 | 9 | #include "Print.h" 10 | 11 | #include // for sprintf 12 | 13 | size_t Print::print(const char s[]) { 14 | size_t n = 0; 15 | while (*s) { 16 | n += write(*s++); 17 | } 18 | return n; 19 | } 20 | 21 | size_t Print::print(double value, int digits) { 22 | char tmp[32]; 23 | sprintf(tmp, "%.*f", digits, value); 24 | return print(tmp); 25 | } 26 | 27 | size_t Print::print(long value) { 28 | char tmp[32]; 29 | sprintf(tmp, "%ld", value); 30 | return print(tmp); 31 | } 32 | 33 | size_t Print::println() { return write('\r') + write('\n'); } 34 | 35 | #endif -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/Print.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef SPARK 4 | 5 | #include 6 | #include 7 | 8 | // This class reproduces Arduino's Print 9 | class Print { 10 | public: 11 | virtual ~Print() {} 12 | 13 | virtual size_t write(uint8_t) = 0; 14 | 15 | size_t print(const char[]); 16 | size_t print(double, int = 2); 17 | size_t print(long); 18 | size_t println(); 19 | }; 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/ReferenceType.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | // A type that is meant to be used by reference only (JsonArray and JsonObject) 13 | class ReferenceType { 14 | public: 15 | bool operator==(const ReferenceType& other) const { 16 | // two JsonArray are equal if they are the same instance 17 | // (we don't compare the content) 18 | return this == &other; 19 | } 20 | 21 | bool operator!=(const ReferenceType& other) const { return this != &other; } 22 | 23 | protected: 24 | ReferenceType() {} 25 | 26 | private: 27 | // copy constructor is private 28 | ReferenceType(const ReferenceType&); 29 | 30 | // copy operator is private 31 | ReferenceType& operator=(const ReferenceType&); 32 | }; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/SparkJson.cpp: -------------------------------------------------------------------------------- 1 | #include "SparkJson.h" 2 | 3 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/SparkJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | // About this file 8 | // --------------- 9 | // This file is here to please the Arduino IDE. It must be present in the src/ 10 | // for the IDE to find it. Feel free to ignore this file if your working in 11 | // another environment 12 | 13 | #include "./ArduinoJson.h" 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/StaticJsonBuffer.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonBuffer.h" 10 | 11 | namespace ArduinoJson { 12 | 13 | // Implements a JsonBuffer with fixed memory allocation. 14 | // The template paramenter CAPACITY specifies the capacity of the buffer in 15 | // bytes. 16 | template 17 | class StaticJsonBuffer : public JsonBuffer { 18 | public: 19 | explicit StaticJsonBuffer() : _size(0) {} 20 | 21 | size_t capacity() const { return CAPACITY; } 22 | size_t size() const { return _size; } 23 | 24 | protected: 25 | virtual void* alloc(size_t bytes) { 26 | if (_size + bytes > CAPACITY) return NULL; 27 | void* p = &_buffer[_size]; 28 | _size += bytes; 29 | return p; 30 | } 31 | 32 | private: 33 | uint8_t _buffer[CAPACITY]; 34 | size_t _size; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/StringBuilder.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "StringBuilder.h" 8 | 9 | using namespace ArduinoJson::Internals; 10 | 11 | size_t StringBuilder::write(uint8_t c) { 12 | if (length >= capacity) return 0; 13 | 14 | buffer[length++] = c; 15 | buffer[length] = '\0'; 16 | return 1; 17 | } 18 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/lib/SparkJson/src/StringBuilder.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "Print.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | // A Print implementation that allows to write in a char[] 15 | class StringBuilder : public Print { 16 | public: 17 | StringBuilder(char *buf, int size) 18 | : buffer(buf), capacity(size - 1), length(0) { 19 | buffer[0] = '\0'; 20 | } 21 | 22 | virtual size_t write(uint8_t c); 23 | 24 | private: 25 | char *buffer; 26 | int capacity; 27 | int length; 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble-characteristics/project.properties: -------------------------------------------------------------------------------- 1 | name=rfid-ble 2 | dependencies.SparkJson=0.0.2 3 | dependencies.HttpClient=0.0.5 4 | dependencies.MFRC522=0.1.4 5 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensions.ignoreRecommendations": true, 3 | "C_Cpp.default.configurationProvider": "particle.particle-vscode-core", 4 | "files.associations": { 5 | "*.ino": "cpp" 6 | }, 7 | "particle.targetDevice": "argon_bobcat" 8 | } -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/HttpClient/library.properties: -------------------------------------------------------------------------------- 1 | name=HttpClient 2 | version=0.0.5 3 | license=MIT 4 | author=Nils Mattisson 5 | sentence=A work in progress Http Client Library for the Spark Core and Arduino. 6 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/HttpClient/src/HttpClient/HttpClient.h: -------------------------------------------------------------------------------- 1 | #include "../HttpClient.h" -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/MFRC522/LICENSE: -------------------------------------------------------------------------------- 1 | * Based on code Dr.Leong ( WWW.B2CQSHOP.COM ) 2 | * Created by Miguel Balboa (circuitito.com), Jan, 2012. 3 | * Rewritten by Søren Thing Andersen (access.thing.dk), fall of 2013 (Translation to English, refactored, comments, anti collision, cascade levels.) 4 | * Released into the public domain. -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/MFRC522/library.properties: -------------------------------------------------------------------------------- 1 | name=MFRC522 2 | version=0.1.4 3 | license=Unknown 4 | author=Paul Kourany 5 | sentence=MFRC522 RFID library for Particle devices 6 | url=https://github.com/pkourany/MFRC522_RFID_Library 7 | repository=https://github.com/pkourany/MFRC522_RFID_Library.git -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/MFRC522/src/MFRC522/MFRC522.h: -------------------------------------------------------------------------------- 1 | #include "../MFRC522.h" -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/library.properties: -------------------------------------------------------------------------------- 1 | name=SparkJson 2 | version=0.0.2 3 | license=Choose a license 4 | author=bblanchon 5 | sentence=JSON library Ported from @bblanchon 6 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "./DynamicJsonBuffer.h" 8 | #include "./JsonArray.h" 9 | #include "./JsonObject.h" 10 | #include "./StaticJsonBuffer.h" 11 | 12 | using namespace ArduinoJson; 13 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/IndentedPrint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "IndentedPrint.h" 8 | 9 | using namespace ArduinoJson::Internals; 10 | 11 | size_t IndentedPrint::write(uint8_t c) { 12 | size_t n = 0; 13 | 14 | if (isNewLine) n += writeTabs(); 15 | 16 | n += sink->write(c); 17 | 18 | isNewLine = c == '\n'; 19 | 20 | return n; 21 | } 22 | 23 | inline size_t IndentedPrint::writeTabs() { 24 | size_t n = 0; 25 | 26 | for (int i = 0; i < level * tabSize; i++) n += sink->write(' '); 27 | 28 | return n; 29 | } 30 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/JsonBufferAllocated.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonBuffer.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | class JsonBufferAllocated { 15 | public: 16 | void *operator new(size_t n, JsonBuffer *jsonBuffer) throw() { 17 | return jsonBuffer->alloc(n); 18 | } 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/JsonPair.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonVariant.h" 10 | 11 | namespace ArduinoJson { 12 | 13 | // A key value pair for JsonObject. 14 | struct JsonPair { 15 | const char* key; 16 | JsonVariant value; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/JsonVariantContent.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | namespace ArduinoJson { 10 | 11 | // Forward declarations 12 | class JsonArray; 13 | class JsonObject; 14 | 15 | namespace Internals { 16 | 17 | // A union that defines the actual content of a JsonVariant. 18 | // The enum JsonVariantType determines which member is in use. 19 | union JsonVariantContent { 20 | bool asBoolean; 21 | double asDouble; // asDouble is also used for float 22 | long asLong; // asLong is also used for char, short and int 23 | const char* asString; // asString can be null 24 | JsonArray* asArray; // asArray cannot be null 25 | JsonObject* asObject; // asObject cannot be null 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/ListNode.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include // for NULL 10 | 11 | #include "JsonBufferAllocated.h" 12 | 13 | namespace ArduinoJson { 14 | namespace Internals { 15 | 16 | // A node for a singly-linked list. 17 | // Used by List and its iterators. 18 | template 19 | struct ListNode : public Internals::JsonBufferAllocated { 20 | ListNode() : next(NULL) {} 21 | 22 | ListNode *next; 23 | T content; 24 | }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/Print.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #ifndef SPARK 8 | 9 | #include "Print.h" 10 | 11 | #include // for sprintf 12 | 13 | size_t Print::print(const char s[]) { 14 | size_t n = 0; 15 | while (*s) { 16 | n += write(*s++); 17 | } 18 | return n; 19 | } 20 | 21 | size_t Print::print(double value, int digits) { 22 | char tmp[32]; 23 | sprintf(tmp, "%.*f", digits, value); 24 | return print(tmp); 25 | } 26 | 27 | size_t Print::print(long value) { 28 | char tmp[32]; 29 | sprintf(tmp, "%ld", value); 30 | return print(tmp); 31 | } 32 | 33 | size_t Print::println() { return write('\r') + write('\n'); } 34 | 35 | #endif -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/Print.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef SPARK 4 | 5 | #include 6 | #include 7 | 8 | // This class reproduces Arduino's Print 9 | class Print { 10 | public: 11 | virtual ~Print() {} 12 | 13 | virtual size_t write(uint8_t) = 0; 14 | 15 | size_t print(const char[]); 16 | size_t print(double, int = 2); 17 | size_t print(long); 18 | size_t println(); 19 | }; 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/ReferenceType.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | // A type that is meant to be used by reference only (JsonArray and JsonObject) 13 | class ReferenceType { 14 | public: 15 | bool operator==(const ReferenceType& other) const { 16 | // two JsonArray are equal if they are the same instance 17 | // (we don't compare the content) 18 | return this == &other; 19 | } 20 | 21 | bool operator!=(const ReferenceType& other) const { return this != &other; } 22 | 23 | protected: 24 | ReferenceType() {} 25 | 26 | private: 27 | // copy constructor is private 28 | ReferenceType(const ReferenceType&); 29 | 30 | // copy operator is private 31 | ReferenceType& operator=(const ReferenceType&); 32 | }; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/SparkJson.cpp: -------------------------------------------------------------------------------- 1 | #include "SparkJson.h" 2 | 3 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/SparkJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | // About this file 8 | // --------------- 9 | // This file is here to please the Arduino IDE. It must be present in the src/ 10 | // for the IDE to find it. Feel free to ignore this file if your working in 11 | // another environment 12 | 13 | #include "./ArduinoJson.h" 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/StaticJsonBuffer.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonBuffer.h" 10 | 11 | namespace ArduinoJson { 12 | 13 | // Implements a JsonBuffer with fixed memory allocation. 14 | // The template paramenter CAPACITY specifies the capacity of the buffer in 15 | // bytes. 16 | template 17 | class StaticJsonBuffer : public JsonBuffer { 18 | public: 19 | explicit StaticJsonBuffer() : _size(0) {} 20 | 21 | size_t capacity() const { return CAPACITY; } 22 | size_t size() const { return _size; } 23 | 24 | protected: 25 | virtual void* alloc(size_t bytes) { 26 | if (_size + bytes > CAPACITY) return NULL; 27 | void* p = &_buffer[_size]; 28 | _size += bytes; 29 | return p; 30 | } 31 | 32 | private: 33 | uint8_t _buffer[CAPACITY]; 34 | size_t _size; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/StringBuilder.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "StringBuilder.h" 8 | 9 | using namespace ArduinoJson::Internals; 10 | 11 | size_t StringBuilder::write(uint8_t c) { 12 | if (length >= capacity) return 0; 13 | 14 | buffer[length++] = c; 15 | buffer[length] = '\0'; 16 | return 1; 17 | } 18 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/lib/SparkJson/src/StringBuilder.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "Print.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | // A Print implementation that allows to write in a char[] 15 | class StringBuilder : public Print { 16 | public: 17 | StringBuilder(char *buf, int size) 18 | : buffer(buf), capacity(size - 1), length(0) { 19 | buffer[0] = '\0'; 20 | } 21 | 22 | virtual size_t write(uint8_t c); 23 | 24 | private: 25 | char *buffer; 26 | int capacity; 27 | int length; 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid-ble/project.properties: -------------------------------------------------------------------------------- 1 | name=rfid-ble 2 | dependencies.SparkJson=0.0.2 3 | dependencies.HttpClient=0.0.5 4 | dependencies.MFRC522=0.1.4 5 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensions.ignoreRecommendations": true, 3 | "C_Cpp.default.configurationProvider": "particle.particle-vscode-core", 4 | "files.associations": { 5 | "*.ino": "cpp" 6 | }, 7 | "particle.targetDevice": "tempSensor" 8 | } -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/HttpClient/library.properties: -------------------------------------------------------------------------------- 1 | name=HttpClient 2 | version=0.0.5 3 | license=MIT 4 | author=Nils Mattisson 5 | sentence=A work in progress Http Client Library for the Spark Core and Arduino. 6 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/HttpClient/src/HttpClient/HttpClient.h: -------------------------------------------------------------------------------- 1 | #include "../HttpClient.h" -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/MFRC522/LICENSE: -------------------------------------------------------------------------------- 1 | * Based on code Dr.Leong ( WWW.B2CQSHOP.COM ) 2 | * Created by Miguel Balboa (circuitito.com), Jan, 2012. 3 | * Rewritten by Søren Thing Andersen (access.thing.dk), fall of 2013 (Translation to English, refactored, comments, anti collision, cascade levels.) 4 | * Released into the public domain. -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/MFRC522/library.properties: -------------------------------------------------------------------------------- 1 | name=MFRC522 2 | version=0.1.4 3 | license=Unknown 4 | author=Paul Kourany 5 | sentence=MFRC522 RFID library for Particle devices 6 | url=https://github.com/pkourany/MFRC522_RFID_Library 7 | repository=https://github.com/pkourany/MFRC522_RFID_Library.git -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/MFRC522/src/MFRC522/MFRC522.h: -------------------------------------------------------------------------------- 1 | #include "../MFRC522.h" -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/library.properties: -------------------------------------------------------------------------------- 1 | name=SparkJson 2 | version=0.0.2 3 | license=Choose a license 4 | author=bblanchon 5 | sentence=JSON library Ported from @bblanchon 6 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "./DynamicJsonBuffer.h" 8 | #include "./JsonArray.h" 9 | #include "./JsonObject.h" 10 | #include "./StaticJsonBuffer.h" 11 | 12 | using namespace ArduinoJson; 13 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/IndentedPrint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "IndentedPrint.h" 8 | 9 | using namespace ArduinoJson::Internals; 10 | 11 | size_t IndentedPrint::write(uint8_t c) { 12 | size_t n = 0; 13 | 14 | if (isNewLine) n += writeTabs(); 15 | 16 | n += sink->write(c); 17 | 18 | isNewLine = c == '\n'; 19 | 20 | return n; 21 | } 22 | 23 | inline size_t IndentedPrint::writeTabs() { 24 | size_t n = 0; 25 | 26 | for (int i = 0; i < level * tabSize; i++) n += sink->write(' '); 27 | 28 | return n; 29 | } 30 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/JsonBufferAllocated.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonBuffer.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | class JsonBufferAllocated { 15 | public: 16 | void *operator new(size_t n, JsonBuffer *jsonBuffer) throw() { 17 | return jsonBuffer->alloc(n); 18 | } 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/JsonPair.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonVariant.h" 10 | 11 | namespace ArduinoJson { 12 | 13 | // A key value pair for JsonObject. 14 | struct JsonPair { 15 | const char* key; 16 | JsonVariant value; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/JsonVariantContent.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | namespace ArduinoJson { 10 | 11 | // Forward declarations 12 | class JsonArray; 13 | class JsonObject; 14 | 15 | namespace Internals { 16 | 17 | // A union that defines the actual content of a JsonVariant. 18 | // The enum JsonVariantType determines which member is in use. 19 | union JsonVariantContent { 20 | bool asBoolean; 21 | double asDouble; // asDouble is also used for float 22 | long asLong; // asLong is also used for char, short and int 23 | const char* asString; // asString can be null 24 | JsonArray* asArray; // asArray cannot be null 25 | JsonObject* asObject; // asObject cannot be null 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/ListNode.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include // for NULL 10 | 11 | #include "JsonBufferAllocated.h" 12 | 13 | namespace ArduinoJson { 14 | namespace Internals { 15 | 16 | // A node for a singly-linked list. 17 | // Used by List and its iterators. 18 | template 19 | struct ListNode : public Internals::JsonBufferAllocated { 20 | ListNode() : next(NULL) {} 21 | 22 | ListNode *next; 23 | T content; 24 | }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/Print.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #ifndef SPARK 8 | 9 | #include "Print.h" 10 | 11 | #include // for sprintf 12 | 13 | size_t Print::print(const char s[]) { 14 | size_t n = 0; 15 | while (*s) { 16 | n += write(*s++); 17 | } 18 | return n; 19 | } 20 | 21 | size_t Print::print(double value, int digits) { 22 | char tmp[32]; 23 | sprintf(tmp, "%.*f", digits, value); 24 | return print(tmp); 25 | } 26 | 27 | size_t Print::print(long value) { 28 | char tmp[32]; 29 | sprintf(tmp, "%ld", value); 30 | return print(tmp); 31 | } 32 | 33 | size_t Print::println() { return write('\r') + write('\n'); } 34 | 35 | #endif -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/Print.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef SPARK 4 | 5 | #include 6 | #include 7 | 8 | // This class reproduces Arduino's Print 9 | class Print { 10 | public: 11 | virtual ~Print() {} 12 | 13 | virtual size_t write(uint8_t) = 0; 14 | 15 | size_t print(const char[]); 16 | size_t print(double, int = 2); 17 | size_t print(long); 18 | size_t println(); 19 | }; 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/ReferenceType.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | // A type that is meant to be used by reference only (JsonArray and JsonObject) 13 | class ReferenceType { 14 | public: 15 | bool operator==(const ReferenceType& other) const { 16 | // two JsonArray are equal if they are the same instance 17 | // (we don't compare the content) 18 | return this == &other; 19 | } 20 | 21 | bool operator!=(const ReferenceType& other) const { return this != &other; } 22 | 23 | protected: 24 | ReferenceType() {} 25 | 26 | private: 27 | // copy constructor is private 28 | ReferenceType(const ReferenceType&); 29 | 30 | // copy operator is private 31 | ReferenceType& operator=(const ReferenceType&); 32 | }; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/SparkJson.cpp: -------------------------------------------------------------------------------- 1 | #include "SparkJson.h" 2 | 3 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/SparkJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | // About this file 8 | // --------------- 9 | // This file is here to please the Arduino IDE. It must be present in the src/ 10 | // for the IDE to find it. Feel free to ignore this file if your working in 11 | // another environment 12 | 13 | #include "./ArduinoJson.h" 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/StaticJsonBuffer.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonBuffer.h" 10 | 11 | namespace ArduinoJson { 12 | 13 | // Implements a JsonBuffer with fixed memory allocation. 14 | // The template paramenter CAPACITY specifies the capacity of the buffer in 15 | // bytes. 16 | template 17 | class StaticJsonBuffer : public JsonBuffer { 18 | public: 19 | explicit StaticJsonBuffer() : _size(0) {} 20 | 21 | size_t capacity() const { return CAPACITY; } 22 | size_t size() const { return _size; } 23 | 24 | protected: 25 | virtual void* alloc(size_t bytes) { 26 | if (_size + bytes > CAPACITY) return NULL; 27 | void* p = &_buffer[_size]; 28 | _size += bytes; 29 | return p; 30 | } 31 | 32 | private: 33 | uint8_t _buffer[CAPACITY]; 34 | size_t _size; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/StringBuilder.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "StringBuilder.h" 8 | 9 | using namespace ArduinoJson::Internals; 10 | 11 | size_t StringBuilder::write(uint8_t c) { 12 | if (length >= capacity) return 0; 13 | 14 | buffer[length++] = c; 15 | buffer[length] = '\0'; 16 | return 1; 17 | } 18 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/lib/SparkJson/src/StringBuilder.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "Print.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | // A Print implementation that allows to write in a char[] 15 | class StringBuilder : public Print { 16 | public: 17 | StringBuilder(char *buf, int size) 18 | : buffer(buf), capacity(size - 1), length(0) { 19 | buffer[0] = '\0'; 20 | } 21 | 22 | virtual size_t write(uint8_t c); 23 | 24 | private: 25 | char *buffer; 26 | int capacity; 27 | int length; 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rfid/project.properties: -------------------------------------------------------------------------------- 1 | name=rfid 2 | dependencies.SparkJson=0.0.2 3 | dependencies.HttpClient=0.0.5 4 | dependencies.MFRC522=0.1.4 5 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "./DynamicJsonBuffer.h" 8 | #include "./JsonArray.h" 9 | #include "./JsonObject.h" 10 | #include "./StaticJsonBuffer.h" 11 | 12 | using namespace ArduinoJson; 13 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/IndentedPrint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "IndentedPrint.h" 8 | 9 | using namespace ArduinoJson::Internals; 10 | 11 | size_t IndentedPrint::write(uint8_t c) { 12 | size_t n = 0; 13 | 14 | if (isNewLine) n += writeTabs(); 15 | 16 | n += sink->write(c); 17 | 18 | isNewLine = c == '\n'; 19 | 20 | return n; 21 | } 22 | 23 | inline size_t IndentedPrint::writeTabs() { 24 | size_t n = 0; 25 | 26 | for (int i = 0; i < level * tabSize; i++) n += sink->write(' '); 27 | 28 | return n; 29 | } 30 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/JsonBufferAllocated.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonBuffer.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | class JsonBufferAllocated { 15 | public: 16 | void *operator new(size_t n, JsonBuffer *jsonBuffer) throw() { 17 | return jsonBuffer->alloc(n); 18 | } 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/JsonPair.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonVariant.h" 10 | 11 | namespace ArduinoJson { 12 | 13 | // A key value pair for JsonObject. 14 | struct JsonPair { 15 | const char* key; 16 | JsonVariant value; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/JsonVariantContent.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | namespace ArduinoJson { 10 | 11 | // Forward declarations 12 | class JsonArray; 13 | class JsonObject; 14 | 15 | namespace Internals { 16 | 17 | // A union that defines the actual content of a JsonVariant. 18 | // The enum JsonVariantType determines which member is in use. 19 | union JsonVariantContent { 20 | bool asBoolean; 21 | double asDouble; // asDouble is also used for float 22 | long asLong; // asLong is also used for char, short and int 23 | const char* asString; // asString can be null 24 | JsonArray* asArray; // asArray cannot be null 25 | JsonObject* asObject; // asObject cannot be null 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/ListNode.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include // for NULL 10 | 11 | #include "JsonBufferAllocated.h" 12 | 13 | namespace ArduinoJson { 14 | namespace Internals { 15 | 16 | // A node for a singly-linked list. 17 | // Used by List and its iterators. 18 | template 19 | struct ListNode : public Internals::JsonBufferAllocated { 20 | ListNode() : next(NULL) {} 21 | 22 | ListNode *next; 23 | T content; 24 | }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/Print.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #ifndef SPARK 8 | 9 | #include "Print.h" 10 | 11 | #include // for sprintf 12 | 13 | size_t Print::print(const char s[]) { 14 | size_t n = 0; 15 | while (*s) { 16 | n += write(*s++); 17 | } 18 | return n; 19 | } 20 | 21 | size_t Print::print(double value, int digits) { 22 | char tmp[32]; 23 | sprintf(tmp, "%.*f", digits, value); 24 | return print(tmp); 25 | } 26 | 27 | size_t Print::print(long value) { 28 | char tmp[32]; 29 | sprintf(tmp, "%ld", value); 30 | return print(tmp); 31 | } 32 | 33 | size_t Print::println() { return write('\r') + write('\n'); } 34 | 35 | #endif -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/Print.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef SPARK 4 | 5 | #include 6 | #include 7 | 8 | // This class reproduces Arduino's Print 9 | class Print { 10 | public: 11 | virtual ~Print() {} 12 | 13 | virtual size_t write(uint8_t) = 0; 14 | 15 | size_t print(const char[]); 16 | size_t print(double, int = 2); 17 | size_t print(long); 18 | size_t println(); 19 | }; 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/ReferenceType.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | // A type that is meant to be used by reference only (JsonArray and JsonObject) 13 | class ReferenceType { 14 | public: 15 | bool operator==(const ReferenceType& other) const { 16 | // two JsonArray are equal if they are the same instance 17 | // (we don't compare the content) 18 | return this == &other; 19 | } 20 | 21 | bool operator!=(const ReferenceType& other) const { return this != &other; } 22 | 23 | protected: 24 | ReferenceType() {} 25 | 26 | private: 27 | // copy constructor is private 28 | ReferenceType(const ReferenceType&); 29 | 30 | // copy operator is private 31 | ReferenceType& operator=(const ReferenceType&); 32 | }; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/SparkJson.cpp: -------------------------------------------------------------------------------- 1 | #include "SparkJson.h" 2 | 3 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/SparkJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | // About this file 8 | // --------------- 9 | // This file is here to please the Arduino IDE. It must be present in the src/ 10 | // for the IDE to find it. Feel free to ignore this file if your working in 11 | // another environment 12 | 13 | #include "./ArduinoJson.h" 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/StaticJsonBuffer.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "JsonBuffer.h" 10 | 11 | namespace ArduinoJson { 12 | 13 | // Implements a JsonBuffer with fixed memory allocation. 14 | // The template paramenter CAPACITY specifies the capacity of the buffer in 15 | // bytes. 16 | template 17 | class StaticJsonBuffer : public JsonBuffer { 18 | public: 19 | explicit StaticJsonBuffer() : _size(0) {} 20 | 21 | size_t capacity() const { return CAPACITY; } 22 | size_t size() const { return _size; } 23 | 24 | protected: 25 | virtual void* alloc(size_t bytes) { 26 | if (_size + bytes > CAPACITY) return NULL; 27 | void* p = &_buffer[_size]; 28 | _size += bytes; 29 | return p; 30 | } 31 | 32 | private: 33 | uint8_t _buffer[CAPACITY]; 34 | size_t _size; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/StringBuilder.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "StringBuilder.h" 8 | 9 | using namespace ArduinoJson::Internals; 10 | 11 | size_t StringBuilder::write(uint8_t c) { 12 | if (length >= capacity) return 0; 13 | 14 | buffer[length++] = c; 15 | buffer[length] = '\0'; 16 | return 1; 17 | } 18 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/StringBuilder.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #pragma once 8 | 9 | #include "Print.h" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | // A Print implementation that allows to write in a char[] 15 | class StringBuilder : public Print { 16 | public: 17 | StringBuilder(char *buf, int size) 18 | : buffer(buf), capacity(size - 1), length(0) { 19 | buffer[0] = '\0'; 20 | } 21 | 22 | virtual size_t write(uint8_t c); 23 | 24 | private: 25 | char *buffer; 26 | int capacity; 27 | int length; 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/examples/IndentedPrintExample/IndentedPrintExample.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Arduino JSON library - IndentedPrint example 3 | * Benoit Blanchon 2014 - MIT License 4 | */ 5 | 6 | #include 7 | 8 | using namespace ArduinoJson::Internals; 9 | 10 | void setup() { 11 | Serial.begin(9600); 12 | 13 | IndentedPrint serial(Serial); 14 | serial.setTabSize(4); 15 | 16 | serial.println("This is at indentation 0"); 17 | serial.indent(); 18 | serial.println("This is at indentation 1"); 19 | serial.println("This is also at indentation 1"); 20 | serial.indent(); 21 | serial.println("This is at indentation 2"); 22 | 23 | serial.unindent(); 24 | serial.unindent(); 25 | serial.println("This is back at indentation 0"); 26 | } 27 | 28 | void loop() { 29 | // not used in this example 30 | } -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/rgb_light_strand/SparkJson/my-core.ino: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://github.com/bblanchon/ArduinoJson 6 | 7 | #include "SparkJson.h" 8 | 9 | void setup() { 10 | Serial.begin(9600); 11 | 12 | StaticJsonBuffer<200> jsonBuffer; 13 | 14 | char json[] = 15 | "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; 16 | 17 | JsonObject& root = jsonBuffer.parseObject(json); 18 | 19 | if (!root.success()) { 20 | Serial.println("parseObject() failed"); 21 | return; 22 | } 23 | 24 | const char* sensor = root["sensor"]; 25 | long time = root["time"]; 26 | double latitude = root["data"][0]; 27 | double longitude = root["data"][1]; 28 | 29 | Serial.println(sensor); 30 | Serial.println(time); 31 | Serial.println(latitude, 6); 32 | Serial.println(longitude, 6); 33 | } 34 | 35 | void loop() { 36 | // not used in this example 37 | } -------------------------------------------------------------------------------- /src/microcontrollers/particle-photon/ribbon-motor-controlled/ribbon-motor-controlled.ino: -------------------------------------------------------------------------------- 1 | int directionPin = D0; 2 | int pwmPin = D2; 3 | int dutyCycle = 170; 4 | int onTimeMs = 10; 5 | int delayBetweenTicks_ms = 5000; 6 | 7 | void tick_motors() 8 | { 9 | digitalWrite(directionPin, LOW); 10 | analogWrite(pwmPin, dutyCycle); 11 | delay(onTimeMs); 12 | analogWrite(pwmPin, 0); 13 | } 14 | 15 | Timer timer(delayBetweenTicks_ms, tick_motors); 16 | 17 | void setup() 18 | { 19 | bool successAttachingSetDelayValue = Particle.function("setDelayValue", setDelayValue); 20 | pinMode(directionPin, OUTPUT); 21 | pinMode(pwmPin, OUTPUT); 22 | timer.start(); 23 | } 24 | 25 | int setDelayValue(String data) 26 | { 27 | Serial.print("Received cloud value:"); 28 | Serial.println(data); 29 | Serial.println("--"); 30 | delayBetweenTicks_ms = data.toInt(); 31 | timer.changePeriod(delayBetweenTicks_ms); 32 | return 1; 33 | } 34 | -------------------------------------------------------------------------------- /src/processing/graphics/code/jeromq-0.5.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/processing/graphics/code/jeromq-0.5.2.jar -------------------------------------------------------------------------------- /src/processing/graphics/data/Inconsolata-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/processing/graphics/data/Inconsolata-Regular.ttf -------------------------------------------------------------------------------- /src/programs/1044.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`laser in region $regionId`, 4 | `region $regionId has name tiger`, 5 | results => { 6 | room.subscriptionPrefix(1); 7 | if (!!results) { 8 | results.forEach(({ regionId }) => { 9 | let ill = room.newIllumination() 10 | ill.fontsize(100) 11 | ill.fontcolor(255, 128, 0) 12 | ill.text(0, 0, "RAWR!") 13 | room.draw(ill); 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | 22 | -------------------------------------------------------------------------------- /src/programs/106__robotCode.py: -------------------------------------------------------------------------------- 1 | from helper import init, claim, retract, prehook, subscription, batch, get_my_id_str 2 | import time 3 | from adafruit_crickit import crickit 4 | 5 | init(__file__, skipListening=True) 6 | 7 | # make two variables for the motors to make code shorter to type 8 | motor_1 = crickit.dc_motor_1 9 | motor_2 = crickit.dc_motor_2 10 | speed_1 = 0.4 11 | speed_2 = speed_1 12 | 13 | while True: 14 | motor_1.throttle = speed 15 | motor_2.throttle = -speed_2 16 | time.sleep(1) 17 | 18 | motor_1.throttle = 0 19 | motor_2.throttle = 0 20 | time.sleep(2) 21 | 22 | motor_1.throttle = -speed 23 | motor_2.throttle = speed_2 24 | time.sleep(1) 25 | 26 | motor_1.throttle = 0 27 | motor_2.throttle = 0 28 | time.sleep(2) 29 | -------------------------------------------------------------------------------- /src/programs/1102__listenToAll.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | var lastResults = {}; 4 | 5 | // room.cleanupOtherSource("1102") 6 | 7 | function makeKey(x) { 8 | return `${JSON.stringify(x.source)}${JSON.stringify(x.fact)}` 9 | } 10 | 11 | room.onGetSource('source', `%fact`, 12 | results => { 13 | if (!!results) { 14 | console.log(`---------- ${Object.keys(lastResults).length} ${results.length}`) 15 | results.forEach(({ source, fact }, i) => { 16 | if (typeof lastResults[makeKey(results[i])] === "undefined") { 17 | console.log(`[[[${source}]]]`, `${fact}`.slice(0, 100).replace(/(\r\n|\n|\r)/gm, "")); 18 | } 19 | }); 20 | lastResults = {}; 21 | for (let i=0; i { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ frame }) => { 8 | let ill = room.newIllumination() 9 | ill.fontsize(30) 10 | ill.image(0, 0, 192, 108, frame) 11 | room.draw(ill) 12 | }); 13 | } 14 | room.subscriptionPostfix(); 15 | }) 16 | 17 | run(); 18 | 19 | -------------------------------------------------------------------------------- /src/programs/1167__showWebcamImage.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`camera sees frame $frame @ $`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ frame }) => { 8 | let ill = room.newIllumination() 9 | ill.fontsize(30) 10 | ill.image(0, 0, 192, 108, frame) 11 | room.draw(ill) 12 | }); 13 | } 14 | room.subscriptionPostfix(); 15 | }) 16 | 17 | run(); 18 | -------------------------------------------------------------------------------- /src/programs/1174.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | 4 | 5 | room.on(`location of $title is $lat lat $long long`, 6 | `Photon says "SOIL_TEMP" is $t`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results) { 10 | results.forEach(({ title, lat, long, t }) => { 11 | let ill = room.newIllumination() 12 | let zoom = 15.0*t/4082.0; 13 | let access_token = process.env.MAPBOX_TOKEN; 14 | let u = `https://api.mapbox.com` + 15 | `/styles/v1/mapbox/streets-v11/static/` + 16 | `${lat},${long},${zoom},0/` + 17 | `300x200` + 18 | `?access_token=${access_token}` 19 | ill.image(30, 30, 360*2, 240*2, u) 20 | ill.text(0, 0, title); 21 | room.draw(ill) 22 | 23 | 24 | }); 25 | } 26 | room.subscriptionPostfix(); 27 | }) 28 | 29 | 30 | run(); 31 | -------------------------------------------------------------------------------- /src/programs/1174.prejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | when location of $title is $lat lat $long long, 4 | Photon says "SOIL_TEMP" is $t: 5 | let ill = room.newIllumination() 6 | let zoom = 15.0*t/4082.0; 7 | let access_token = process.env.MAPBOX_TOKEN; 8 | let u = `https://api.mapbox.com` + 9 | `/styles/v1/mapbox/streets-v11/static/` + 10 | `${lat},${long},${zoom},0/` + 11 | `300x200` + 12 | `?access_token=${access_token}` 13 | ill.image(30, 30, 360*2, 240*2, u) 14 | ill.text(0, 0, title); 15 | room.draw(ill) 16 | -------------------------------------------------------------------------------- /src/programs/1201__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run, MY_ID_STR } = require('../helpers/helper')(__filename); 2 | 3 | const M = 1200; 4 | const P = parseInt(myId)-1; 5 | 6 | room.on( 7 | `test client ${M} says $x @ $time`, 8 | results => { 9 | // console.error(results); 10 | room.subscriptionPrefix(1); 11 | if (!!results) { 12 | const currentTimeMs = (new Date()).getTime() 13 | // room.assert(`test client ${myId} says ${myId} @ ${currentTimeMs}`); 14 | room.assert(["text", "test"], ["text", "client"], ["integer", `${myId}`], ["text", "says"], ["integer", `${myId}`], ["text", "@"], ["integer", `${currentTimeMs}`]); 15 | } 16 | room.subscriptionPostfix(); 17 | } 18 | ) 19 | 20 | run() 21 | -------------------------------------------------------------------------------- /src/programs/1202__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run, MY_ID_STR } = require('../helpers/helper')(__filename); 2 | 3 | const M = 1200; 4 | const P = parseInt(myId)-1; 5 | 6 | room.on( 7 | `test client ${M} says $x @ $time1`, 8 | `test client ${P} says $y @ $time2`, 9 | results => { 10 | // console.error(results); 11 | room.subscriptionPrefix(1); 12 | if (!!results) { 13 | const currentTimeMs = (new Date()).getTime() 14 | // room.assert(`test client ${myId} says ${myId} @ ${currentTimeMs}`); 15 | room.assert(["text", "test"], ["text", "client"], ["integer", `${myId}`], ["text", "says"], ["integer", `${myId}`], ["text", "@"], ["integer", `${currentTimeMs}`]); 16 | } 17 | room.subscriptionPostfix(); 18 | } 19 | ) 20 | 21 | run() 22 | -------------------------------------------------------------------------------- /src/programs/1203__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run, MY_ID_STR } = require('../helpers/helper')(__filename); 2 | 3 | const M = 1200; 4 | const P = parseInt(myId)-1; 5 | 6 | room.on( 7 | `test client ${M} says $x @ $time1`, 8 | `test client ${P} says $y @ $time2`, 9 | results => { 10 | // console.error(results); 11 | room.subscriptionPrefix(1); 12 | if (!!results) { 13 | const currentTimeMs = (new Date()).getTime() 14 | // room.assert(`test client ${myId} says ${myId} @ ${currentTimeMs}`); 15 | room.assert(["text", "test"], ["text", "client"], ["integer", `${myId}`], ["text", "says"], ["integer", `${myId}`], ["text", "@"], ["integer", `${currentTimeMs}`]); 16 | } 17 | room.subscriptionPostfix(); 18 | } 19 | ) 20 | 21 | run() 22 | -------------------------------------------------------------------------------- /src/programs/1204__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run, MY_ID_STR } = require('../helpers/helper')(__filename); 2 | 3 | const M = 1200; 4 | const P = parseInt(myId)-1; 5 | 6 | room.on( 7 | `test client ${M} says $x @ $time1`, 8 | `test client ${P} says $y @ $time2`, 9 | results => { 10 | // console.error(results); 11 | room.subscriptionPrefix(1); 12 | if (!!results) { 13 | const currentTimeMs = (new Date()).getTime() 14 | // room.assert(`test client ${myId} says ${myId} @ ${currentTimeMs}`); 15 | room.assert(["text", "test"], ["text", "client"], ["integer", `${myId}`], ["text", "says"], ["integer", `${myId}`], ["text", "@"], ["integer", `${currentTimeMs}`]); 16 | } 17 | room.subscriptionPostfix(); 18 | } 19 | ) 20 | 21 | run() 22 | -------------------------------------------------------------------------------- /src/programs/1205__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run, MY_ID_STR } = require('../helpers/helper')(__filename); 2 | 3 | const M = 1200; 4 | const P = parseInt(myId)-1; 5 | 6 | room.on( 7 | `test client ${M} says $x @ $time1`, 8 | `test client ${P} says $y @ $time2`, 9 | results => { 10 | // console.error(results); 11 | room.subscriptionPrefix(1); 12 | if (!!results) { 13 | const currentTimeMs = (new Date()).getTime() 14 | // room.assert(`test client ${myId} says ${myId} @ ${currentTimeMs}`); 15 | room.assert(["text", "test"], ["text", "client"], ["integer", `${myId}`], ["text", "says"], ["integer", `${myId}`], ["text", "@"], ["integer", `${currentTimeMs}`]); 16 | } 17 | room.subscriptionPostfix(); 18 | } 19 | ) 20 | 21 | run() 22 | -------------------------------------------------------------------------------- /src/programs/1206__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run, MY_ID_STR } = require('../helpers/helper')(__filename); 2 | 3 | const M = 1200; 4 | const P = parseInt(myId)-1; 5 | 6 | room.on( 7 | `test client ${M} says $x @ $time1`, 8 | `test client ${P} says $y @ $time2`, 9 | results => { 10 | // console.error(results); 11 | room.subscriptionPrefix(1); 12 | if (!!results) { 13 | const currentTimeMs = (new Date()).getTime() 14 | // room.assert(`test client ${myId} says ${myId} @ ${currentTimeMs}`); 15 | room.assert(["text", "test"], ["text", "client"], ["integer", `${myId}`], ["text", "says"], ["integer", `${myId}`], ["text", "@"], ["integer", `${currentTimeMs}`]); 16 | } 17 | room.subscriptionPostfix(); 18 | } 19 | ) 20 | 21 | run() 22 | -------------------------------------------------------------------------------- /src/programs/1207__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run, MY_ID_STR } = require('../helpers/helper')(__filename); 2 | 3 | const M = 1200; 4 | const P = parseInt(myId)-1; 5 | 6 | room.on( 7 | `test client ${M} says $x @ $time1`, 8 | `test client ${P} says $y @ $time2`, 9 | results => { 10 | // console.error(results); 11 | room.subscriptionPrefix(1); 12 | if (!!results) { 13 | const currentTimeMs = (new Date()).getTime() 14 | // room.assert(`test client ${myId} says ${myId} @ ${currentTimeMs}`); 15 | room.assert(["text", "test"], ["text", "client"], ["integer", `${myId}`], ["text", "says"], ["integer", `${myId}`], ["text", "@"], ["integer", `${currentTimeMs}`]); 16 | } 17 | room.subscriptionPostfix(); 18 | } 19 | ) 20 | 21 | run() 22 | -------------------------------------------------------------------------------- /src/programs/1208__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run, MY_ID_STR } = require('../helpers/helper')(__filename); 2 | 3 | const M = 1200; 4 | const P = parseInt(myId)-1; 5 | 6 | room.on( 7 | `test client ${M} says $x @ $time1`, 8 | `test client ${P} says $y @ $time2`, 9 | results => { 10 | // console.error(results); 11 | room.subscriptionPrefix(1); 12 | if (!!results) { 13 | const currentTimeMs = (new Date()).getTime() 14 | // room.assert(`test client ${myId} says ${myId} @ ${currentTimeMs}`); 15 | room.assert(["text", "test"], ["text", "client"], ["integer", `${myId}`], ["text", "says"], ["integer", `${myId}`], ["text", "@"], ["integer", `${currentTimeMs}`]); 16 | } 17 | room.subscriptionPostfix(); 18 | } 19 | ) 20 | 21 | run() 22 | -------------------------------------------------------------------------------- /src/programs/1209__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run, MY_ID_STR } = require('../helpers/helper')(__filename); 2 | 3 | const M = 1200; 4 | const P = parseInt(myId)-1; 5 | 6 | room.on( 7 | `test client ${M} says $x @ $time1`, 8 | `test client ${P} says $y @ $time2`, 9 | results => { 10 | // console.error(results); 11 | room.subscriptionPrefix(1); 12 | if (!!results) { 13 | const currentTimeMs = (new Date()).getTime() 14 | // room.assert(`test client ${myId} says ${myId} @ ${currentTimeMs}`); 15 | room.assert(["text", "test"], ["text", "client"], ["integer", `${myId}`], ["text", "says"], ["integer", `${myId}`], ["text", "@"], ["integer", `${currentTimeMs}`]); 16 | } 17 | room.subscriptionPostfix(); 18 | } 19 | ) 20 | 21 | run() 22 | -------------------------------------------------------------------------------- /src/programs/1210__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run, MY_ID_STR } = require('../helpers/helper')(__filename); 2 | 3 | const M = 1200; 4 | const P = parseInt(myId)-1; 5 | 6 | room.on( 7 | `test client ${M} says $x @ $time1`, 8 | `test client ${P} says $y @ $time2`, 9 | results => { 10 | console.error(results); 11 | room.subscriptionPrefix(1); 12 | if (!!results) { 13 | const currentTimeMs = (new Date()).getTime() 14 | // room.assert(`test client ${myId} says ${myId} @ ${currentTimeMs}`); 15 | room.assert(["text", "test"], ["text", "client"], ["integer", `${myId}`], ["text", "says"], ["integer", `${myId}`], ["text", "@"], ["integer", `${currentTimeMs}`]); 16 | } 17 | room.subscriptionPostfix(); 18 | } 19 | ) 20 | 21 | run() 22 | -------------------------------------------------------------------------------- /src/programs/1244.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`$photon says the analog value is $value`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ photon, value }) => { 8 | let ill = room.newIllumination() 9 | const fontSize = 20; 10 | ill.fontsize(fontSize) 11 | ill.text(0, 0, `Analog\nValue:\n${value}`) 12 | room.draw(ill) 13 | room.assert(`analogValue is ${value}`) 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | 22 | -------------------------------------------------------------------------------- /src/programs/1259.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | let ill = room.newIllumination() 4 | ill.fontcolor(255, 0, 0); 5 | ill.text(0, 0, "Hello World!") 6 | room.draw(ill); 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/1269.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | let ill = room.newIllumination() 4 | ill.text(0, 0, "test") 5 | // let u = "https://haiperspace.com/writing/20-02-11-rfid-cards/rfid-card-cover.png" 6 | let lat = -71.1034; 7 | let long = 42.3834; 8 | let zoom = 12.13; 9 | let access_token = process.env.MAPBOX_TOKEN; 10 | let u = `https://api.mapbox.com` + 11 | `/styles/v1/mapbox/streets-v11/static/` + 12 | `${lat},${long},${zoom},0/` + 13 | `300x200` + 14 | `?access_token=${access_token}` 15 | ill.image(30, 30, 360*4, 240*4, u) 16 | room.draw(ill) 17 | 18 | 19 | 20 | 21 | run(); 22 | -------------------------------------------------------------------------------- /src/programs/1269.prejs: -------------------------------------------------------------------------------- 1 | let ill = room.newIllumination() 2 | ill.text(0, 0, "test") 3 | // let u = "https://haiperspace.com/writing/20-02-11-rfid-cards/rfid-card-cover.png" 4 | let lat = -71.1034; 5 | let long = 42.3834; 6 | let zoom = 12.13; 7 | let access_token = process.env.MAPBOX_TOKEN; 8 | let u = `https://api.mapbox.com` + 9 | `/styles/v1/mapbox/streets-v11/static/` + 10 | `${lat},${long},${zoom},0/` + 11 | `300x200` + 12 | `?access_token=${access_token}` 13 | ill.image(30, 30, 360*4, 240*4, u) 14 | room.draw(ill) 15 | -------------------------------------------------------------------------------- /src/programs/1347.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.cleanup() 4 | room.assert(`hey11`) 5 | 6 | const code = ` 7 | from helper import init 8 | import time 9 | from adafruit_crickit import crickit 10 | 11 | init(__file__, skipListening=True) 12 | 13 | motor_1 = crickit.dc_motor_1 14 | motor_2 = crickit.dc_motor_2 15 | speed_1 = 0.4 16 | speed_2 = speed_1 17 | 18 | def move(c1, c2, t): 19 | motor_1.throttle = speed_1 * c1 20 | motor_2.throttle = speed_2 * c2 21 | time.sleep(t) 22 | 23 | move(1, 1, 1) 24 | move(0, 0, 1) 25 | move(-1, -1, 1) 26 | move(0, 0, 1) 27 | `; 28 | 29 | room.assert(`wish`, ["text", code], `runs on robot`) 30 | 31 | 32 | 33 | run(); 34 | -------------------------------------------------------------------------------- /src/programs/1347.prejs: -------------------------------------------------------------------------------- 1 | room.cleanup() 2 | claim hey11 3 | 4 | const code = ` 5 | from helper import init 6 | import time 7 | from adafruit_crickit import crickit 8 | 9 | init(__file__, skipListening=True) 10 | 11 | motor_1 = crickit.dc_motor_1 12 | motor_2 = crickit.dc_motor_2 13 | speed_1 = 0.4 14 | speed_2 = speed_1 15 | 16 | def move(c1, c2, t): 17 | motor_1.throttle = speed_1 * c1 18 | motor_2.throttle = speed_2 * c2 19 | time.sleep(t) 20 | 21 | move(1, 1, 1) 22 | move(0, 0, 1) 23 | move(-1, -1, 1) 24 | move(0, 0, 1) 25 | `; 26 | 27 | claim wish`, ["text", code], `runs on robot -------------------------------------------------------------------------------- /src/programs/1414.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | data = [] 4 | size = 21 5 | 6 | room.on(`measured latency $h ms at $`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results && results.length > 0) { 10 | results.forEach(({ h }) => { 11 | data.push(h) 12 | data = data.slice(-size) 13 | room.assert(`"System Lag" data is "${data.toString()}"`) 14 | 15 | }); 16 | } 17 | room.subscriptionPostfix(); 18 | }) 19 | 20 | 21 | run(); 22 | -------------------------------------------------------------------------------- /src/programs/1414.prejs: -------------------------------------------------------------------------------- 1 | data = [] 2 | size = 21 3 | 4 | when measured latency $h ms at $: 5 | data.push(h) 6 | data = data.slice(-size) 7 | claim "System Lag" data is "${data.toString()}" -------------------------------------------------------------------------------- /src/programs/1567.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | function draw(v) { 4 | let ill = room.newIllumination() 5 | ill.text(100, 650, v) 6 | ill.text(100, 100, "value = step rotation") 7 | let x = 400; 8 | let y = 600; 9 | let r = 0; 10 | let l = 100; 11 | for (let i=0; i<10; i+=1) { 12 | let nx = x + l * Math.cos(r); 13 | let ny = y + l * Math.sin(r); 14 | ill.line(x,y,nx,ny) 15 | r += v * Math.PI/200.0; 16 | x = nx; 17 | y = ny; 18 | } 19 | room.draw(ill) 20 | } 21 | 22 | room.on(`Photon says "SOIL_TEMP" is $t`, 23 | results => { 24 | room.subscriptionPrefix(1); 25 | if (!!results && results.length > 0) { 26 | results.forEach(({ t }) => { 27 | let v = (+t)/40; 28 | draw(v) 29 | 30 | }); 31 | } 32 | room.subscriptionPostfix(); 33 | }) 34 | 35 | 36 | 37 | run(); 38 | -------------------------------------------------------------------------------- /src/programs/1567.prejs: -------------------------------------------------------------------------------- 1 | function draw(v) { 2 | let ill = room.newIllumination() 3 | ill.text(100, 650, v) 4 | ill.text(100, 100, "value = step rotation") 5 | let x = 400; 6 | let y = 600; 7 | let r = 0; 8 | let l = 100; 9 | for (let i=0; i<10; i+=1) { 10 | let nx = x + l * Math.cos(r); 11 | let ny = y + l * Math.sin(r); 12 | ill.line(x,y,nx,ny) 13 | r += v * Math.PI/200.0; 14 | x = nx; 15 | y = ny; 16 | } 17 | room.draw(ill) 18 | } 19 | 20 | when Photon says "SOIL_TEMP" is $t: 21 | let v = (+t)/40; 22 | draw(v) 23 | end -------------------------------------------------------------------------------- /src/programs/1635.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | function draw(v) { 4 | const colorMap = { 5 | 6: [255, 0, 0], 6 | 12: [255, 255, 0], 7 | 5: [0, 255, 255], 8 | 11: [0, 0, 255], 9 | 10: [0, 255, 0], 10 | 4: [255, 0, 255] 11 | } 12 | let ill = room.newIllumination() 13 | ill.fontcolor(255, 255, 0) 14 | ill.fontsize(80) 15 | ill.text(55, 300, `${v}`) 16 | ill.nostroke() 17 | if (v in colorMap) { 18 | const col = colorMap[v]; 19 | ill.fill(col[0], col[1], col[2]) 20 | ill.rect(50, 50, 600, 900) 21 | } 22 | room.draw(ill) 23 | } 24 | 25 | room.on(`camera $ sees aruco $id at $ $ $ $ $ $ $ $ @ $t`, 26 | results => { 27 | room.subscriptionPrefix(1); 28 | if (!!results && results.length > 0) { 29 | results.forEach(({ id, t }) => { 30 | if (["2","7"].indexOf(id) === -1) { 31 | draw(parseInt(id)) 32 | } 33 | 34 | }); 35 | } 36 | room.subscriptionPostfix(); 37 | }) 38 | 39 | 40 | 41 | run(); 42 | -------------------------------------------------------------------------------- /src/programs/1635.prejs: -------------------------------------------------------------------------------- 1 | function draw(v) { 2 | const colorMap = { 3 | 6: [255, 0, 0], 4 | 12: [255, 255, 0], 5 | 5: [0, 255, 255], 6 | 11: [0, 0, 255], 7 | 10: [0, 255, 0], 8 | 4: [255, 0, 255] 9 | } 10 | let ill = room.newIllumination() 11 | ill.fontcolor(255, 255, 0) 12 | ill.fontsize(80) 13 | ill.text(55, 300, `${v}`) 14 | ill.nostroke() 15 | if (v in colorMap) { 16 | const col = colorMap[v]; 17 | ill.fill(col[0], col[1], col[2]) 18 | ill.rect(50, 50, 600, 900) 19 | } 20 | room.draw(ill) 21 | } 22 | 23 | when camera $ sees aruco $id at $ $ $ $ $ $ $ $ @ $t: 24 | if (["2","7"].indexOf(id) === -1) { 25 | draw(parseInt(id)) 26 | } 27 | end -------------------------------------------------------------------------------- /src/programs/166.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | data = [] 4 | size = 40 5 | 6 | room.on(`time is $t`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results) { 10 | results.forEach(({ t }) => { 11 | data.push(50 + 50*Math.sin(t/1000.0)) 12 | data = data.slice(-size) 13 | room.assert(`"Sin wave" data is "${data.toString()}"`) 14 | 15 | }); 16 | } 17 | room.subscriptionPostfix(); 18 | }) 19 | 20 | 21 | run(); 22 | -------------------------------------------------------------------------------- /src/programs/166.prejs: -------------------------------------------------------------------------------- 1 | data = [] 2 | size = 40 3 | 4 | when time is $t: 5 | data.push(50 + 50*Math.sin(t/1000.0)) 6 | data = data.slice(-size) 7 | claim "Sin wave" data is "${data.toString()}" -------------------------------------------------------------------------------- /src/programs/1673.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`block code $code wip`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ code }) => { 8 | let ill = room.newIllumination() 9 | ill.text(0, 0, "ROBOT CODE:") 10 | ill.fontsize(7) 11 | ill.text(0, 10, code); 12 | room.draw(ill) 13 | 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/1720.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | var dots = []; 4 | let W = 720; 5 | let H = 950; 6 | let DS = 20; 7 | let L = 0.4; 8 | let MAXN = 100; 9 | let delay = Math.floor(1000/5) 10 | 11 | function makeDot() { 12 | return { 13 | x: 100 + Math.random()*W, 14 | y: 0 15 | } 16 | } 17 | 18 | function draw() { 19 | if (dots.length < MAXN && Math.random() < L) { 20 | dots.push(makeDot()) 21 | } 22 | room.cleanup() 23 | let ill = room.newIllumination() 24 | for (let i=0; i H) { 28 | dots[i] = makeDot() 29 | } 30 | ill.ellipse(dots[i].x, dots[i].y, DS, DS); 31 | } 32 | room.draw(ill); 33 | room.flush() 34 | setTimeout(() => { draw() }, delay) 35 | } 36 | draw() 37 | 38 | 39 | 40 | run(); 41 | -------------------------------------------------------------------------------- /src/programs/1720.prejs: -------------------------------------------------------------------------------- 1 | var dots = []; 2 | let W = 720; 3 | let H = 950; 4 | let DS = 20; 5 | let L = 0.4; 6 | let MAXN = 100; 7 | let delay = Math.floor(1000/5) 8 | 9 | function makeDot() { 10 | return { 11 | x: 100 + Math.random()*W, 12 | y: 0 13 | } 14 | } 15 | 16 | function draw() { 17 | if (dots.length < MAXN && Math.random() < L) { 18 | dots.push(makeDot()) 19 | } 20 | room.cleanup() 21 | let ill = room.newIllumination() 22 | for (let i=0; i H) { 26 | dots[i] = makeDot() 27 | } 28 | ill.ellipse(dots[i].x, dots[i].y, DS, DS); 29 | } 30 | room.draw(ill); 31 | room.flush() 32 | setTimeout(() => { draw() }, delay) 33 | } 34 | draw() -------------------------------------------------------------------------------- /src/programs/1733.py: -------------------------------------------------------------------------------- 1 | TODO -------------------------------------------------------------------------------- /src/programs/1751.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.onRaw(`$ $ paper ${myId} is pointing at paper $id`, 4 | `$ $ paper $id has id $fullId`, 5 | `$fullId $ $title data is $x`, 6 | results => { 7 | room.subscriptionPrefix(1); 8 | if (!!results) { 9 | results.forEach(({ title, x }) => { 10 | data = x.toString().split(" , ").map(v => parseFloat(v)) 11 | const rollingAvg = data.reduce((acc, v) => acc + v * 1.0 / data.length, 0); 12 | ill = room.newIllumination() 13 | ill.fontcolor(255, 255, 0) 14 | ill.text(0, 0, title); 15 | ill.text(0, 14, "rolling\naverage") 16 | ill.fontcolor(255, 255, 255) 17 | ill.fontsize(25) 18 | ill.text(0, 50, `${rollingAvg.toFixed(2)}`) 19 | room.draw(ill) 20 | 21 | }); 22 | } else { 23 | ill = room.newIllumination() 24 | ill.text(0, 0, "No data") 25 | room.draw(ill) 26 | 27 | } 28 | room.subscriptionPostfix(); 29 | }) 30 | 31 | 32 | run(); 33 | 34 | -------------------------------------------------------------------------------- /src/programs/1761.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | import neopixel 5 | 6 | pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.2, auto_write=False) 7 | 8 | while True: 9 | for i in range(len(pixels)): 10 | pixels[i] = (0, 0, 200) 11 | pixels.show() 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/programs/1762.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | import adafruit_thermistor 5 | import neopixel 6 | from progspace_room import Room 7 | 8 | room = Room(use_debug=True) 9 | thermistor = adafruit_thermistor.Thermistor(board.TEMPERATURE, 10000, 10000, 25, 3950) 10 | pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.2, auto_write=False) 11 | 12 | while True: 13 | while room.connected(): 14 | room.cleanup() 15 | room.claim('temp is {}'.format(thermistor.temperature)) 16 | for i in range(len(pixels)): 17 | pixels[i] = (0, 0, 255) 18 | pixels.show() 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/programs/1763.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | import adafruit_thermistor 5 | from progspace_room import Room 6 | 7 | room = Room(use_debug=True) 8 | thermistor = adafruit_thermistor.Thermistor(board.TEMPERATURE, 10000, 10000, 25, 3950) 9 | 10 | while True: 11 | while room.connected(): 12 | room.cleanup() 13 | room.claim('temp is {}'.format(thermistor.temperature)) 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/programs/1765.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | import neopixel 5 | 6 | pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.2, auto_write=False) 7 | 8 | while True: 9 | for i in range(len(pixels)): 10 | pixels[i] = (200, 0, 0) 11 | pixels.show() 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/programs/1766.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | # from progspace_room import Room 5 | from adafruit_circuitplayground import cp 6 | 7 | # room = Room(use_debug=True) 8 | 9 | while True: 10 | # while room.connected(): 11 | while True: 12 | cp.play_file("oh.wav") 13 | time.sleep(3) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/programs/1767.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | from digitalio import DigitalInOut, Direction, Pull 4 | from analogio import AnalogOut 5 | 6 | direction_pin = DigitalInOut(board.D0) 7 | direction_pin.direction = Direction.OUTPUT 8 | analog_out = AnalogOut(board.A0) 9 | 10 | while True: 11 | time.sleep(1) 12 | print("hey") 13 | direction_pin.value = False 14 | analog_out.value = 43690 15 | time.sleep(0.01) 16 | analog_out.value = 0 17 | -------------------------------------------------------------------------------- /src/programs/1768.py: -------------------------------------------------------------------------------- 1 | from adafruit_magtag.magtag import MagTag 2 | import re 3 | DATA_SOURCE = "http://192.168.1.34:5000/select?first=1&subscription=%5B%22reading%20list%20%24%20is%20%24title%20%24%20%24%22%5D" 4 | magtag = MagTag(url=DATA_SOURCE) 5 | magtag.network.connect() 6 | magtag.add_text( 7 | text_position=( 8 | (magtag.graphics.display.width // 2) - 1, 9 | (magtag.graphics.display.height // 2) - 1, 10 | ), 11 | text_scale=3, 12 | text_anchor_point=(0.5, 0.5), 13 | is_data=False, 14 | ) 15 | try: 16 | value = magtag.fetch() 17 | print("Response is", value) 18 | title = re.search(r"title\":\"(.+)\"", value).group(1) 19 | magtag.set_text("Read\n"+title, 0) 20 | except (ValueError, RuntimeError) as e: 21 | print("Some error occured, retrying! -", e) 22 | magtag.exit_and_deep_sleep(60) 23 | -------------------------------------------------------------------------------- /src/programs/1769.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | from progspace_room import Room 5 | 6 | room = Room(use_debug=True) 7 | 8 | while True: 9 | while room.connected(): 10 | room.cleanup() 11 | room.claim('temp is {}'.format(5)) 12 | time.sleep(1) 13 | 14 | -------------------------------------------------------------------------------- /src/programs/1770.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | from progspace_room import Room 5 | from adafruit_circuitplayground import cp 6 | 7 | room = Room(use_debug=False) 8 | prev_val = False 9 | 10 | while True: 11 | while room.connected(): 12 | if cp.button_a != prev_val: 13 | print("button change") 14 | prev_val = cp.button_a 15 | room.cleanup() 16 | if prev_val: 17 | print("claim pressed") 18 | room.claim('button is pressed') 19 | time.sleep(0.1) 20 | 21 | -------------------------------------------------------------------------------- /src/programs/1771.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | from progspace_room import Room 5 | from analogio import AnalogIn 6 | 7 | analog_in = AnalogIn(board.A2) 8 | 9 | room = Room(use_debug=True) 10 | 11 | while True: 12 | while room.connected(): 13 | room.cleanup() 14 | room.claim('soil is {}'.format(analog_in.value)) 15 | time.sleep(1) 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/programs/1772.py: -------------------------------------------------------------------------------- 1 | import time 2 | from adafruit_clue import clue 3 | from progspace_room import Room 4 | 5 | room = Room(use_debug=True) 6 | clue_display = clue.simple_text_display(text_scale=6) 7 | clue_display[0].text = "Init" 8 | clue_display.show() 9 | last_value = 0 10 | 11 | def update_activity(new_activity): 12 | global clue_display, last_value 13 | if last_value != new_activity: 14 | last_value = new_activity 15 | clue_display[0].text = new_activity 16 | clue_display.show() 17 | room.cleanup() 18 | room.claim('activity is {}'.format(new_activity)) 19 | 20 | while True: 21 | while room.connected(): 22 | if clue.button_a: 23 | update_activity("work") 24 | if clue.button_b: 25 | update_activity("play") 26 | -------------------------------------------------------------------------------- /src/programs/1773.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | from progspace_room import Room 5 | 6 | room = Room(use_debug=True) 7 | 8 | while True: 9 | while room.connected(): 10 | room.cleanup() 11 | room.claim('temp is {}'.format(5)) 12 | time.sleep(1) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/programs/1778.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | import random 5 | # from progspace_room import Room 6 | from adafruit_circuitplayground import cp 7 | 8 | # room = Room(use_debug=True) 9 | 10 | while True: 11 | while True: # while room.connected(): 12 | time.sleep(2+random.random()*5) 13 | cp.play_tone(240 + random.randint(0, 60), random.random()*0.4) 14 | cp.play_tone(240 + random.randint(0, 60), random.random()*0.4) 15 | cp.play_tone(240 + random.randint(0, 60), random.random()*0.4) 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/programs/1779.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import busio 4 | import usb_hid 5 | from adafruit_bus_device.i2c_device import I2CDevice 6 | import adafruit_dotstar 7 | from adafruit_hid.consumer_control import ConsumerControl 8 | from adafruit_hid.consumer_control_code import ConsumerControlCode 9 | from digitalio import DigitalInOut, Direction, Pull 10 | 11 | cs = DigitalInOut(board.GP17) 12 | cs.direction = Direction.OUTPUT 13 | cs.value = 0 14 | num_pixels = 16 15 | pixels = adafruit_dotstar.DotStar(board.GP18, board.GP19, num_pixels, brightness=0.1, auto_write=True) 16 | i2c = busio.I2C(board.GP5, board.GP4) 17 | 18 | while True: 19 | for i in range(16): 20 | pixels[i] = (200, 0, 200) 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/programs/1780.py: -------------------------------------------------------------------------------- 1 | import time 2 | import board 3 | import analogio 4 | from progspace_room import Room 5 | 6 | room = Room(use_debug=True) 7 | 8 | while True: 9 | while room.connected(): 10 | room.cleanup() 11 | room.claim('temp is {}'.format(5)) 12 | time.sleep(1) 13 | 14 | -------------------------------------------------------------------------------- /src/programs/1804__editPaperSeen.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`camera 99 sees paper 1013 at TL( 0 , 0 ) TR ( 1920 , 0 ) BR ( 1920 , 1080 ) BL ( 0 , 1080 ) @ 1`) 4 | room.assert(`paper 1013 has width 1920 height 1080 angle 0 at ( 0 , 0 )`) 5 | 6 | room.onRaw(`#1800 $ camera $ sees paper $id at TL ($x1, $y1) TR ($x2, $y2) BR ($x3, $y3) BL ($x4, $y4) @ $time`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results) { 10 | results.forEach(({ id }) => { 11 | room.assert(`camera 99 sees paper 1013 at TL( 0 , 0 ) TR ( 1920 , 0 ) BR ( 1920 , 1080 ) BL ( 0 , 1080 ) @ 1`) 12 | room.assert(`paper 1013 has width 1920 height 1080 angle 0 at ( 0 , 0 )`) 13 | room.assert(`paper 1013 is pointing at paper ${id}`) 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/1910.prejs: -------------------------------------------------------------------------------- 1 | const PW = 1280 2 | const PH = 720 3 | var ill; 4 | 5 | function xRect(y, w ,h, xp) { 6 | let p = xp ? xp : 0.666; 7 | ill.stroke(255, 50,0 ) 8 | ill.rect(PW*0.5-w*0.5, y, w, h) 9 | ill.stroke("white") 10 | ill.line(PW*0.5-w*0.5, y+h*p, PW*0.5+w*0.5, y+h*p) 11 | } 12 | 13 | when paper2 $ calibration for $displayId is $M1 $M2 $M3 $M4 $M5 $M6 $M7 $M8 $M9: 14 | ill = room.newIllumination() 15 | ill.set_transform(+M1,+M2,+M3,+M4,+M5,+M6,+M7,+M8,+M9) 16 | ill.stroke("white") 17 | ill.strokewidth(3) 18 | ill.nofill() 19 | xRect(140, 1000, 100) 20 | let Y2 = 320; 21 | let H2 = 45; 22 | xRect(Y2, 900,H2) 23 | xRect(Y2+H2, 600 ,H2) 24 | xRect(Y2+2*H2, 250, H2) 25 | let Y3 = 490; 26 | let H3 = 45; 27 | xRect(Y3, 800 ,H3) 28 | xRect(Y3+H3*1.3, 900 ,H3) 29 | room.draw(ill, `${displayId}`) 30 | end 31 | 32 | -------------------------------------------------------------------------------- /src/programs/1911.prejs: -------------------------------------------------------------------------------- 1 | var C = [1, 0, 0, 0, 1, 0, 0, 0, 1]; 2 | var CS = {} 3 | var cam_display_map = {} 4 | 5 | when camera $cam calibration for $display is $M1 $M2 $M3 $M4 $M5 $M6 $M7 $M8 $M9: 6 | CS[`${cam}`] = [+M1, +M2, +M3, +M4, +M5, +M6, +M7, +M8, +M9] 7 | cam_display_map[`${cam}`] = display 8 | end 9 | 10 | when laser seen at $x $y @ $t on camera $cam: 11 | 12 | let ill = room.newIllumination() 13 | if (!!CS[`${cam}`]) { 14 | let m = CS[`${cam}`]; 15 | ill.set_transform(m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8]) 16 | } else { 17 | ill.set_transform(C[0], C[1], C[2], C[3], C[4], C[5], C[6], C[7], C[8]) 18 | } 19 | ill.fill(255, 255, 255) 20 | ill.stroke(255, 0, 0); 21 | ill.ellipse(+x-20, +y-20, 40, 40) 22 | if (!!CS[`${cam}`]) { 23 | room.draw(ill, cam_display_map[`${cam}`]) 24 | } else { 25 | room.draw(ill) 26 | } 27 | -------------------------------------------------------------------------------- /src/programs/1912.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | N = 20 4 | L = [] 5 | 6 | room.on(`measured latency $x ms at $`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results && results.length > 0) { 10 | results.forEach(({ x }) => { 11 | L.push(x) 12 | L = L.slice(-N) 13 | let ill = room.newIllumination() 14 | ill.fontsize(20) 15 | ill.fontcolor(255, 255, 255) 16 | ill.fill(255, 0, 0, 128) 17 | ill.nostroke() 18 | L.forEach((v, i) => { 19 | ill.text(0, i*25, `LAG: ${v}`) 20 | ill.rect(100, i*25, Math.min(+v, 1000), 20) 21 | }) 22 | room.draw(ill) 23 | 24 | 25 | }); 26 | } 27 | room.subscriptionPostfix(); 28 | }) 29 | 30 | 31 | run(); 32 | -------------------------------------------------------------------------------- /src/programs/1912.prejs: -------------------------------------------------------------------------------- 1 | N = 20 2 | L = [] 3 | 4 | when measured latency $x ms at $: 5 | L.push(x) 6 | L = L.slice(-N) 7 | let ill = room.newIllumination() 8 | ill.fontsize(20) 9 | ill.fontcolor(255, 255, 255) 10 | ill.fill(255, 0, 0, 128) 11 | ill.nostroke() 12 | L.forEach((v, i) => { 13 | ill.text(0, i*25, `LAG: ${v}`) 14 | ill.rect(100, i*25, Math.min(+v, 1000), 20) 15 | }) 16 | room.draw(ill) 17 | -------------------------------------------------------------------------------- /src/programs/1913.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | var show_circle = true; 4 | 5 | room.on(`microphone heard $x @ $t`, 6 | results => { 7 | room.subscriptionPrefix(1); 8 | if (!!results && results.length > 0) { 9 | results.forEach(({ x, t }) => { 10 | 11 | if (x.includes("computer") && x.includes("circle")) { 12 | if (x.includes("show")) { 13 | show_circle = true; 14 | room.assert("wish speaker said", ["text", "showing circle"]) 15 | } 16 | if (x.includes("hide")) { 17 | show_circle = false; 18 | room.assert("wish speaker said", ["text", "goodbye circle"]) 19 | } 20 | } 21 | 22 | let ill = room.newIllumination() 23 | if (show_circle) { 24 | ill.fill("red"); 25 | ill.ellipse(0, 0, 200, 200); 26 | } 27 | room.draw(ill); 28 | 29 | 30 | }); 31 | } 32 | room.subscriptionPostfix(); 33 | }) 34 | 35 | 36 | run(); 37 | -------------------------------------------------------------------------------- /src/programs/1913.prejs: -------------------------------------------------------------------------------- 1 | var show_circle = true; 2 | 3 | when microphone heard $x @ $t: 4 | 5 | if (x.includes("computer") && x.includes("circle")) { 6 | if (x.includes("show")) { 7 | show_circle = true; 8 | room.assert("wish speaker said", ["text", "showing circle"]) 9 | } 10 | if (x.includes("hide")) { 11 | show_circle = false; 12 | room.assert("wish speaker said", ["text", "goodbye circle"]) 13 | } 14 | } 15 | 16 | let ill = room.newIllumination() 17 | if (show_circle) { 18 | ill.fill("red"); 19 | ill.ellipse(0, 0, 200, 200); 20 | } 21 | room.draw(ill); 22 | -------------------------------------------------------------------------------- /src/programs/1914.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`microphone heard $x @ $t`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ x, t }) => { 8 | 9 | if (x.includes("what") && x.includes("time")) { 10 | let d = (new Date()).toLocaleTimeString('en-US', {'hour': '2-digit', 'minute': '2-digit'}) 11 | room.assert(`wish speaker said`, ["text", `It is ${d}`]) 12 | } 13 | 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/1914.prejs: -------------------------------------------------------------------------------- 1 | when microphone heard $x @ $t: 2 | 3 | if (x.includes("what") && x.includes("time")) { 4 | let d = (new Date()).toLocaleTimeString('en-US', {'hour': '2-digit', 'minute': '2-digit'}) 5 | room.assert(`wish speaker said`, ["text", `It is ${d}`]) 6 | } -------------------------------------------------------------------------------- /src/programs/1915.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`microphone heard $x @ $t`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ x, t }) => { 8 | 9 | let ill = room.newIllumination() 10 | ill.fontsize(80) 11 | ill.stroke("white") 12 | ill.text(0, 0, "Microphone heard:") 13 | ill.text(0, 120, x) 14 | room.draw(ill) 15 | 16 | 17 | }); 18 | } 19 | room.subscriptionPostfix(); 20 | }) 21 | 22 | 23 | run(); 24 | -------------------------------------------------------------------------------- /src/programs/1915.prejs: -------------------------------------------------------------------------------- 1 | when microphone heard $x @ $t: 2 | 3 | let ill = room.newIllumination() 4 | ill.fontsize(80) 5 | ill.stroke("white") 6 | ill.text(0, 0, "Microphone heard:") 7 | ill.text(0, 120, x) 8 | room.draw(ill) 9 | -------------------------------------------------------------------------------- /src/programs/1916.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`microphone heard $x @ $t`, 4 | `current weather is $temp F and $weather`, 5 | results => { 6 | room.subscriptionPrefix(1); 7 | if (!!results) { 8 | results.forEach(({ x, t, temp, weather }) => { 9 | if (x.includes("what") && (x.includes("weather") || x.includes("temperature"))) { 10 | room.assert(`wish speaker said`, ["text", `It is ${temp} degrees and ${weather.split("-").join(" ")}`]) 11 | } 12 | 13 | 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/1916.prejs: -------------------------------------------------------------------------------- 1 | when microphone heard $x @ $t, 2 | current weather is $temp F and $weather: 3 | if (x.includes("what") && (x.includes("weather") || x.includes("temperature"))) { 4 | room.assert(`wish speaker said`, ["text", `It is ${temp} degrees and ${weather.split("-").join(" ")}`]) 5 | } 6 | -------------------------------------------------------------------------------- /src/programs/1918.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | const W = 1280; 4 | const H = 720; 5 | const OFFSET = 200; 6 | const S = 10; 7 | let ill = room.newIllumination() 8 | ill.nostroke(); 9 | ill.fill(0, 0, 40); 10 | ill.rect(0, 0, W, H); 11 | ill.fill(255, 0, 0); 12 | ill.rect(OFFSET-S, OFFSET-S, S, S); 13 | ill.rect(W-OFFSET-S, OFFSET-S, S, S); 14 | ill.rect(W-OFFSET-S, H-OFFSET-S, S, S); 15 | ill.rect(OFFSET-S, H-OFFSET-S, S, S); 16 | room.draw(ill) 17 | 18 | 19 | 20 | 21 | run(); 22 | -------------------------------------------------------------------------------- /src/programs/1918.prejs: -------------------------------------------------------------------------------- 1 | const W = 1280; 2 | const H = 720; 3 | const OFFSET = 200; 4 | const S = 10; 5 | let ill = room.newIllumination() 6 | ill.nostroke(); 7 | ill.fill(0, 0, 40); 8 | ill.rect(0, 0, W, H); 9 | ill.fill(255, 0, 0); 10 | ill.rect(OFFSET-S, OFFSET-S, S, S); 11 | ill.rect(W-OFFSET-S, OFFSET-S, S, S); 12 | ill.rect(W-OFFSET-S, H-OFFSET-S, S, S); 13 | ill.rect(OFFSET-S, H-OFFSET-S, S, S); 14 | room.draw(ill) 15 | -------------------------------------------------------------------------------- /src/programs/1919.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`microphone heard $x @ $t`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ x, t }) => { 8 | if (x.includes("hello")) { 9 | room.assert(`wish speaker said "Happy Friday"`) 10 | } 11 | 12 | 13 | 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/1919.prejs: -------------------------------------------------------------------------------- 1 | when microphone heard $x @ $t: 2 | if (x.includes("hello")) { 3 | claim wish speaker said "Happy Friday" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /src/programs/1920.prejs: -------------------------------------------------------------------------------- 1 | var last_time = 0; 2 | var expire_time = 0; 3 | var knownTimes = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"]; 4 | 5 | when microphone heard $x @ $t: 6 | if ((x.includes("alarm") || x.includes("timer")) && x.includes("minute")) { 7 | for (let i=0; i 0) { 18 | if (t >= expire_time) { 19 | expire_time = 0; 20 | room.assert(`wish speaker said`, ["text", `timer is done`]) 21 | } else { 22 | room.assert(`wish speaker said`, ["text", `${expire_time - t}`]) 23 | } 24 | } 25 | end 26 | -------------------------------------------------------------------------------- /src/programs/1969.py: -------------------------------------------------------------------------------- 1 | from helper import prehook, subscription, batch, get_my_id_str 2 | 3 | # Write your code here 4 | 5 | init(__file__) 6 | -------------------------------------------------------------------------------- /src/programs/1971.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.onRaw(`$ $ paper ${myId} is pointing at paper $id`, 4 | `$ $ paper $id has id $fullId`, 5 | `$fullId $ $title data is $x`, 6 | results => { 7 | room.subscriptionPrefix(1); 8 | if (!!results) { 9 | results.forEach(({ title, x }) => { 10 | data = x.toString().split(" , ").map(v => parseFloat(v)) 11 | ill = room.newIllumination() 12 | ill.nostroke() 13 | ill.scale(3, 3) 14 | ill.fill(200, 100, 100) 15 | data.forEach((d, i) => { 16 | ill.rect(0, 10*i, d*100, 10) 17 | }) 18 | ill.translate(20, 0) 19 | ill.rotate(Math.PI/2.0) 20 | ill.text(0, 0, title); 21 | room.draw(ill) 22 | 23 | }); 24 | } else { 25 | ill = room.newIllumination() 26 | ill.text(0, 0, "No data") 27 | room.draw(ill) 28 | 29 | } 30 | room.subscriptionPostfix(); 31 | }) 32 | 33 | 34 | run(); 35 | -------------------------------------------------------------------------------- /src/programs/1971.prejs: -------------------------------------------------------------------------------- 1 | when $title data is $x: 2 | data = x.toString().split(" , ").map(v => parseFloat(v)) 3 | ill = room.newIllumination() 4 | ill.nostroke() 5 | ill.fill(200, 100, 100) 6 | data.forEach((d, i) => { 7 | ill.rect(0, 10*i, d, 10) 8 | }) 9 | ill.translate(20, 0) 10 | ill.rotate(Math.PI/2.0) 11 | ill.text(0, 0, title); 12 | room.draw(ill) 13 | otherwise: 14 | ill = room.newIllumination() 15 | ill.text(0, 0, "No data") 16 | room.draw(ill) 17 | -------------------------------------------------------------------------------- /src/programs/1976.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`I wish I was highlighted blue`) 4 | 5 | 6 | 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/1976.prejs: -------------------------------------------------------------------------------- 1 | claim I wish I was highlighted blue 2 | -------------------------------------------------------------------------------- /src/programs/1977.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | // Play 4 | // "Tell Me How You Really Feel" 5 | // Courtney Barnett 6 | room.assert(`wish spotify:album:3l7JWewI3ZByxaT5BCgRx2 would be played on Spotify`) 7 | 8 | 9 | 10 | 11 | run(); 12 | -------------------------------------------------------------------------------- /src/programs/1977.prejs: -------------------------------------------------------------------------------- 1 | // Play 2 | // "Tell Me How You Really Feel" 3 | // Courtney Barnett 4 | claim wish spotify:album:3l7JWewI3ZByxaT5BCgRx2 would be played on Spotify 5 | -------------------------------------------------------------------------------- /src/programs/1978.prejs: -------------------------------------------------------------------------------- 1 | when time is $t: 2 | if (t%10 === 0) { 3 | claim wish currently Spotify song would be updated 4 | } 5 | end 6 | 7 | when currently playing Spotify song is $title by $artist @ $t: 8 | let ill = room.newIllumination() 9 | ill.fontsize(50) 10 | ill.fontcolor(100, 100, 150) 11 | ill.text(20, 20, "Currently playing:") 12 | ill.text(20, 140, `${title}`) 13 | ill.text(20, 260, `${artist}`) 14 | room.draw(ill) 15 | otherwise: 16 | drawNothingPlaying(); 17 | end 18 | 19 | when currently playing Spotify song is nothing @ $t: 20 | drawNothingPlaying(); 21 | end 22 | 23 | function drawNothingPlaying(){ 24 | let ill = room.newIllumination() 25 | ill.fontsize(100) 26 | ill.fontcolor(100, 100, 100) 27 | ill.text(20, 20, "Nothing playing") 28 | room.draw(ill) 29 | } -------------------------------------------------------------------------------- /src/programs/1979.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`laser in region $r @ $t`, 4 | `region $r has name album1`, 5 | results => { 6 | room.subscriptionPrefix(1); 7 | if (!!results) { 8 | results.forEach(({ r, t }) => { 9 | // It's Alright by Horsebeach 10 | room.assert(`wish spotify:track:0ZAdCDeysyoh5BOpuSGKy3 would be played on Spotify`) 11 | 12 | 13 | }); 14 | } 15 | room.subscriptionPostfix(); 16 | }) 17 | 18 | 19 | run(); 20 | -------------------------------------------------------------------------------- /src/programs/1979.prejs: -------------------------------------------------------------------------------- 1 | when laser in region $r @ $t, 2 | region $r has name album1: 3 | // It's Alright by Horsebeach 4 | claim wish spotify:track:0ZAdCDeysyoh5BOpuSGKy3 would be played on Spotify 5 | -------------------------------------------------------------------------------- /src/programs/1981.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`aruco sees $frame @ $t`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ frame, t }) => { 8 | // xhen camera sees frame $frame @ $: 9 | // xhen camera "1994" screenshot $frame by $source: 10 | let ill = room.newIllumination() 11 | ill.fontsize(30) 12 | ill.scale(5, 5) 13 | ill.image(0, 0, 192, 108, frame) 14 | room.draw(ill); 15 | 16 | 17 | }); 18 | } 19 | room.subscriptionPostfix(); 20 | }) 21 | 22 | 23 | run(); 24 | -------------------------------------------------------------------------------- /src/programs/1981.prejs: -------------------------------------------------------------------------------- 1 | when aruco sees $frame @ $t: 2 | // xhen camera sees frame $frame @ $: 3 | // xhen camera "1994" screenshot $frame by $source: 4 | let ill = room.newIllumination() 5 | ill.fontsize(30) 6 | ill.scale(5, 5) 7 | ill.image(0, 0, 192, 108, frame) 8 | room.draw(ill); 9 | -------------------------------------------------------------------------------- /src/programs/1982.prejs: -------------------------------------------------------------------------------- 1 | var C = [1,0,0,0,1,0,0,0,1]; 2 | var D = "1997"; 3 | 4 | when nowplaying $ calibration for $displayId is $M1 $M2 $M3 $M4 $M5 $M6 $M7 $M8 $M9: 5 | C = [+M1, +M2, +M3, +M4, +M5, +M6, +M7, +M8, +M9]; 6 | D = `${displayId}`; 7 | end 8 | 9 | function render(text) { 10 | let ill = room.newIllumination() 11 | ill.set_transform(C[0], C[1], C[2], C[3], C[4], C[5], C[6], C[7], C[8], C[9]) 12 | ill.fontsize(150) 13 | ill.text(20, 150, `${text}`) 14 | room.draw(ill, D) 15 | } 16 | 17 | when currently playing Spotify song is $title by $artist @ $t: 18 | cleanup 19 | render(`${title}\n${artist}`) 20 | otherwise: 21 | cleanup 22 | render(`-`) 23 | end 24 | 25 | when currently playing Spotify song is nothing @ $t: 26 | cleanup 27 | render(`-`) 28 | end -------------------------------------------------------------------------------- /src/programs/1983.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | FRAMES = [] 4 | currentFrame = 0 5 | 6 | room.on(`camera sees subframe $i $frame @ $`, 7 | results => { 8 | FRAMES = results.slice(0) 9 | FRAMES.sort((a,b) => a["i"] - b["i"]) 10 | 11 | }) 12 | 13 | room.on(`time is $t`, 14 | results => { 15 | room.subscriptionPrefix(2); 16 | if (!!results && results.length > 0) { 17 | results.forEach(({ t }) => { 18 | if (FRAMES.length > 0) { 19 | currentFrame += 1 20 | if (currentFrame >= FRAMES.length) { 21 | currentFrame = 0; 22 | } 23 | let ill = room.newIllumination() 24 | ill.image(0, 0, 5*50, 5*100, FRAMES[currentFrame]["frame"]) 25 | room.draw(ill) 26 | } 27 | 28 | }); 29 | } 30 | room.subscriptionPostfix(); 31 | }) 32 | 33 | 34 | 35 | 36 | run(); 37 | -------------------------------------------------------------------------------- /src/programs/1983.prejs: -------------------------------------------------------------------------------- 1 | FRAMES = [] 2 | currentFrame = 0 3 | 4 | when new $results of camera sees subframe $i $frame @ $: 5 | FRAMES = results.slice(0) 6 | FRAMES.sort((a,b) => a["i"] - b["i"]) 7 | end 8 | 9 | when time is $t: 10 | if (FRAMES.length > 0) { 11 | currentFrame += 1 12 | if (currentFrame >= FRAMES.length) { 13 | currentFrame = 0; 14 | } 15 | let ill = room.newIllumination() 16 | ill.image(0, 0, 5*50, 5*100, FRAMES[currentFrame]["frame"]) 17 | room.draw(ill) 18 | } 19 | end 20 | -------------------------------------------------------------------------------- /src/programs/1984.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | const W = 50; 4 | const H = 100; 5 | 6 | room.on(`camera sees subframe $i $frame @ $`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results && results.length > 0) { 10 | results.forEach(({ i, frame }) => { 11 | let ill = room.newIllumination() 12 | ill.image(i*W*2, 0, W*2, H*2, frame) 13 | room.draw(ill) 14 | 15 | 16 | }); 17 | } 18 | room.subscriptionPostfix(); 19 | }) 20 | 21 | 22 | run(); 23 | -------------------------------------------------------------------------------- /src/programs/1984.prejs: -------------------------------------------------------------------------------- 1 | const W = 50; 2 | const H = 100; 3 | 4 | when camera sees subframe $i $frame @ $: 5 | let ill = room.newIllumination() 6 | ill.image(i*W*2, 0, W*2, H*2, frame) 7 | room.draw(ill) 8 | -------------------------------------------------------------------------------- /src/programs/1985.prejs: -------------------------------------------------------------------------------- 1 | let fs = require('fs'); 2 | let path = require('path'); 3 | let p = n => path.join(__dirname, '..', 'files', n) 4 | let lastFrame = null; 5 | 6 | when camera sees frame $frame @ $t: 7 | lastFrame = frame; 8 | room.cleanup() 9 | let ill = room.newIllumination() 10 | ill.scale(5, 5) 11 | ill.image(0, 0, 192, 108, frame) 12 | room.draw(ill); 13 | end 14 | 15 | when time is $t: 16 | let offset = t % (60*5); // 5 min 17 | if (offset === 0 && !!lastFrame) { 18 | fs.writeFile(p(`timelapse1985_${t}`), lastFrame, err => { 19 | if (err) return console.log(err); 20 | console.log("saved timelapse photo"); 21 | }); 22 | room.cleanup() 23 | let ill = room.newIllumination() 24 | ill.fontcolor(0, 255, 0); 25 | ill.fontsize(200) 26 | ill.text(0, 0, "SAVED") 27 | room.draw(ill); 28 | } 29 | end -------------------------------------------------------------------------------- /src/programs/1986.prejs: -------------------------------------------------------------------------------- 1 | const delay = Math.floor(1000/5); 2 | const WIDTH = 900; 3 | const HEIGHT = 500; 4 | let t = 0; 5 | let wiggle = 30; 6 | 7 | function draw() { 8 | room.cleanup() 9 | t = (t + 1) % 30; 10 | let ill = room.newIllumination() 11 | ill.nostroke() 12 | ill.fill(255, 0, 0) 13 | for (let x = 0; x < WIDTH; x += 50) { 14 | for (let y = 0; y < HEIGHT; y += 50) { 15 | ill.rect( 16 | 50 + x+25-25/2 + wiggle*Math.sin(x+t*2*Math.PI/30), 17 | 50 + y+25-25/2 + wiggle*Math.cos(x+t*2*Math.PI/30), 18 | 25, 25) 19 | } 20 | } 21 | room.draw(ill); 22 | room.flush() 23 | setTimeout(() => { draw() }, delay); 24 | } 25 | draw(); 26 | 27 | when Photon says "SOIL_TEMP" is $t: 28 | let v = (+t)/40; 29 | wiggle = Math.max(1, Math.min(v, 100)) 30 | end 31 | -------------------------------------------------------------------------------- /src/programs/1988.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | // Write your code here 4 | 5 | run(); 6 | -------------------------------------------------------------------------------- /src/programs/1988.prejs: -------------------------------------------------------------------------------- 1 | // Write your code here 2 | -------------------------------------------------------------------------------- /src/programs/1__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, scriptName } = require('../helpers/helper')(__filename); 2 | 3 | let N = 100 4 | let i = 0 5 | 6 | room.on( 7 | `$X ${myId} has $Y toes`, 8 | results => { 9 | console.log("results:") 10 | console.log(results) 11 | i += 1; 12 | if (i >= N) { 13 | console.log("\n...DONE!") 14 | process.exit(0); 15 | } 16 | room.assert(`Man ${myId} has ${i} toes`) 17 | } 18 | ) -------------------------------------------------------------------------------- /src/programs/2000__blank.prejs: -------------------------------------------------------------------------------- 1 | cleanup 2 | 3 | function drawFace(ill, current_time) { 4 | ill.push() 5 | ill.translate(0, 50 + 50 * Math.sin(current_time/5.0)) 6 | ill.fill("blue") 7 | ill.nostroke() 8 | let face_width=100 9 | let face_height=100 10 | let eye_size = 10 11 | ill.ellipse(0, 0, face_width, face_height); 12 | ill.fill("white") 13 | ill.ellipse(face_width/4, face_height/3, eye_size, eye_size); 14 | ill.ellipse(face_height*3/4.0, face_height/3, eye_size, eye_size); 15 | let mouth_y = face_height*0.6 16 | ill.stroke("yellow") 17 | ill.line(face_width/5, mouth_y, face_width*4.0/5.0, mouth_y); 18 | ill.pop() 19 | } 20 | 21 | when time is $time: 22 | cleanup 23 | let ill = room.newIllumination(); 24 | drawFace(ill, time); 25 | room.draw(ill); -------------------------------------------------------------------------------- /src/programs/2001__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`measured latency $t ms at $`, 4 | results => { 5 | console.log("NEW RESULTS"); 6 | console.log(results); 7 | room.subscriptionPrefix(1); 8 | if (!!results && results.length > 0) { 9 | results.forEach(({ t }) => { 10 | let ill = room.newIllumination() 11 | ill.fontsize(300) 12 | ill.fontcolor("white") 13 | ill.text(0, 0, `${t}ms\nLAG`) 14 | room.draw(ill) 15 | 16 | 17 | }); 18 | } 19 | room.subscriptionPostfix(); 20 | }) 21 | 22 | 23 | run(); 24 | -------------------------------------------------------------------------------- /src/programs/2001__blank.prejs: -------------------------------------------------------------------------------- 1 | when measured latency $t ms at $: 2 | let ill = room.newIllumination() 3 | ill.fontsize(300) 4 | ill.fontcolor("white") 5 | ill.text(0, 0, `${t}ms\nLAG`) 6 | room.draw(ill) 7 | -------------------------------------------------------------------------------- /src/programs/2002__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | const code = ` 4 | #include "HttpClient.h" 5 | 6 | int lastButtonState = HIGH; 7 | 8 | void setup() { 9 | pinMode(D7, OUTPUT); 10 | pinMode(D0, INPUT); 11 | } 12 | 13 | void loop() { 14 | int buttonState = digitalRead(D0); 15 | if (buttonState == HIGH) { 16 | digitalWrite(D7, HIGH); 17 | } else { 18 | digitalWrite(D7, LOW); 19 | } 20 | if (lastButtonState == LOW && buttonState == HIGH) { 21 | char body[300]; 22 | sprintf(body, 23 | "{\\"claim\\":\\"button was pressed @ %ld\\", " 24 | "\\"retract\\":\\"$ $ button was pressed @ $\\"}", 25 | Time.now()); 26 | publishValueMessage(body); 27 | } 28 | lastButtonState = buttonState; 29 | } 30 | ` 31 | room.assert(`wish`, ["text", code], `runs on the photon`) 32 | 33 | 34 | 35 | 36 | run(); 37 | -------------------------------------------------------------------------------- /src/programs/2002__blank.prejs: -------------------------------------------------------------------------------- 1 | const code = ` 2 | #include "HttpClient.h" 3 | 4 | int lastButtonState = HIGH; 5 | 6 | void setup() { 7 | pinMode(D7, OUTPUT); 8 | pinMode(D0, INPUT); 9 | } 10 | 11 | void loop() { 12 | int buttonState = digitalRead(D0); 13 | if (buttonState == HIGH) { 14 | digitalWrite(D7, HIGH); 15 | } else { 16 | digitalWrite(D7, LOW); 17 | } 18 | if (lastButtonState == LOW && buttonState == HIGH) { 19 | char body[300]; 20 | sprintf(body, 21 | "{\\"claim\\":\\"button was pressed @ %ld\\", " 22 | "\\"retract\\":\\"$ $ button was pressed @ $\\"}", 23 | Time.now()); 24 | publishValueMessage(body); 25 | } 26 | lastButtonState = buttonState; 27 | } 28 | ` 29 | claim wish`, ["text", code], `runs on the photon 30 | -------------------------------------------------------------------------------- /src/programs/2003__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`I wish I was highlighted red`) 4 | 5 | /* 6 | room.on(`$ $photon sees color ( $r, $g, $b )`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results) { 10 | results.forEach(({ photon, r, g, b }) => { 11 | room.cleanup() 12 | let r = results[0].r; 13 | let g = results[0].g; 14 | let b = results[0].b; 15 | let scale = x => Math.floor(x * 0.3); 16 | room.assert(`wish RGB light strand is color ${scale(r)} ${scale(g)} ${scale(b)}`) 17 | 18 | }); 19 | } else { 20 | room.cleanup() 21 | room.assert(`wish RGB light strand is color 10 0 0`) 22 | } 23 | room.subscriptionPostfix(); 24 | }) 25 | */ 26 | 27 | 28 | 29 | run(); 30 | -------------------------------------------------------------------------------- /src/programs/2003__blank.prejs: -------------------------------------------------------------------------------- 1 | claim I wish I was highlighted red 2 | 3 | /* 4 | when $ $photon sees color ( $r, $g, $b ): 5 | cleanup 6 | let r = results[0].r; 7 | let g = results[0].g; 8 | let b = results[0].b; 9 | let scale = x => Math.floor(x * 0.3); 10 | claim wish RGB light strand is color ${scale(r)} ${scale(g)} ${scale(b)} 11 | otherwise: 12 | cleanup 13 | claim wish RGB light strand is color 10 0 0 14 | end 15 | */ -------------------------------------------------------------------------------- /src/programs/2004__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | const DELAY_MS = 500; 4 | 5 | function tick() { 6 | room.cleanup() 7 | room.assert(`time is ${(new Date()).getTime()}`) 8 | let ill = room.newIllumination() 9 | ill.text(0, 100, "I am a clock") 10 | room.draw(ill); 11 | room.flush(); 12 | setTimeout(tick, DELAY_MS); 13 | } 14 | 15 | tick(); 16 | 17 | 18 | 19 | run(); 20 | -------------------------------------------------------------------------------- /src/programs/2004__blank.prejs: -------------------------------------------------------------------------------- 1 | const DELAY_MS = 500; 2 | 3 | function tick() { 4 | cleanup 5 | claim time is ${(new Date()).getTime()} 6 | let ill = room.newIllumination() 7 | ill.text(0, 100, "I am a clock") 8 | room.draw(ill); 9 | room.flush(); 10 | setTimeout(tick, DELAY_MS); 11 | } 12 | 13 | tick(); -------------------------------------------------------------------------------- /src/programs/2005__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.onGetSource('source', `I wish I was highlighted $color`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ color, source }) => { 8 | let ill = room.newIllumination() 9 | ill.fill(color) 10 | ill.rect(0, 0, 1920, 1080); 11 | room.draw(ill, source) 12 | 13 | 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/2005__blank.prejs: -------------------------------------------------------------------------------- 1 | when I wish I was highlighted $color by $source: 2 | let ill = room.newIllumination() 3 | ill.fill(color) 4 | ill.rect(0, 0, 1920, 1080); 5 | room.draw(ill, source) 6 | -------------------------------------------------------------------------------- /src/programs/2006__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`$ says the humidity is $H and temp is $T`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ H, T }) => { 8 | if (H > 50) { 9 | room.assert(`I wish I was highlighted red`) 10 | } else { 11 | room.assert(`I wish I was highlighted green`) 12 | } 13 | 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/2006__blank.prejs: -------------------------------------------------------------------------------- 1 | when $ says the humidity is $H and temp is $T: 2 | if (H > 50) { 3 | claim I wish I was highlighted red 4 | } else { 5 | claim I wish I was highlighted green 6 | } -------------------------------------------------------------------------------- /src/programs/2007__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`$ says the humidity is $H and temp is $T`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ H, T }) => { 8 | let ill = room.newIllumination() 9 | ill.text(25, 50, "humidity " + H) 10 | ill.text(25, 100, "temp " + T) 11 | room.draw(ill) 12 | 13 | }); 14 | } 15 | room.subscriptionPostfix(); 16 | }) 17 | 18 | 19 | run(); 20 | -------------------------------------------------------------------------------- /src/programs/2007__blank.prejs: -------------------------------------------------------------------------------- 1 | when $ says the humidity is $H and temp is $T: 2 | let ill = room.newIllumination() 3 | ill.text(25, 50, "humidity " + H) 4 | ill.text(25, 100, "temp " + T) 5 | room.draw(ill) 6 | -------------------------------------------------------------------------------- /src/programs/2008__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`time is $time`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ time }) => { 8 | if (Math.floor(time/1000) % 2 === 0) { 9 | room.assert(`I wish I was highlighted orange`) 10 | } 11 | 12 | }); 13 | } 14 | room.subscriptionPostfix(); 15 | }) 16 | 17 | 18 | run(); 19 | -------------------------------------------------------------------------------- /src/programs/2008__blank.prejs: -------------------------------------------------------------------------------- 1 | when time is $time: 2 | if (Math.floor(time/1000) % 2 === 0) { 3 | claim I wish I was highlighted orange 4 | } 5 | -------------------------------------------------------------------------------- /src/programs/2010__blank.prejs: -------------------------------------------------------------------------------- 1 | let data = [] 2 | const max_data = 10 3 | const OX = 120 4 | const W = 5 5 | const H = 5 6 | const C = 4 7 | 8 | when $ says the humidity is $H and temp is $T: 9 | data.push(H); 10 | data = data.slice(-max_data); 11 | let ill = room.newIllumination() 12 | ill.fontsize(12) 13 | ill.text(25, 25, data.join("\n")) 14 | ill.line(OX, H, OX + max_data*W, H) 15 | ill.line(OX, H, OX, H + 100*C) 16 | ill.stroke(255, 255, 0) 17 | for (let i = 0; i < data.length; i += 1) { 18 | if (i > 0) { 19 | ill.line(OX + (i-1)*W, H+data[i-1]*C, 20 | OX + i*W, H+data[i] *C) 21 | } 22 | ill.ellipse(OX + i*W, H+data[i]*C, 3, 3) 23 | } 24 | room.draw(ill) 25 | otherwise: 26 | let ill = room.newIllumination() 27 | ill.text(25, 25, "No data yet") 28 | room.draw(ill) 29 | -------------------------------------------------------------------------------- /src/programs/2012__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | let count = 0; 4 | room.globalAssert(`count is 0`) 5 | 6 | room.on(`circuit playground "BUTTON_A" has value 1`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results && results.length > 0) { 10 | results.forEach(({ }) => { 11 | 12 | room.retractAll(`count is $`) 13 | count += 1; 14 | room.globalAssert(`count is ${count}`) 15 | 16 | 17 | }); 18 | } 19 | room.subscriptionPostfix(); 20 | }) 21 | 22 | 23 | 24 | 25 | run(); 26 | -------------------------------------------------------------------------------- /src/programs/2012__blank.prejs: -------------------------------------------------------------------------------- 1 | let count = 0; 2 | global claim count is 0 3 | 4 | when circuit playground "BUTTON_A" has value 1: 5 | 6 | global retract count is $ 7 | count += 1; 8 | global claim count is ${count} 9 | 10 | end 11 | -------------------------------------------------------------------------------- /src/programs/2013__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`$ says the humidity is $H and temp is $T`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ H, T }) => { 8 | let ill = room.newIllumination() 9 | ill.text(25, 50, "humidity " + H) 10 | ill.text(25, 100, "temp " + T) 11 | room.draw(ill) 12 | 13 | }); 14 | } 15 | room.subscriptionPostfix(); 16 | }) 17 | 18 | 19 | run(); 20 | -------------------------------------------------------------------------------- /src/programs/2013__blank.prejs: -------------------------------------------------------------------------------- 1 | when $ says the humidity is $H and temp is $T: 2 | let ill = room.newIllumination() 3 | ill.text(25, 50, "humidity " + H) 4 | ill.text(25, 100, "temp " + T) 5 | room.draw(ill) 6 | -------------------------------------------------------------------------------- /src/programs/2014__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`circuit playground "BUTTON_A" has value 0`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ }) => { 8 | 9 | room.assert(`wish circuit playground neopixel 0 had color 0 0 0`) 10 | 11 | 12 | }); 13 | } 14 | room.subscriptionPostfix(); 15 | }) 16 | 17 | room.on(`circuit playground "BUTTON_A" has value 1`, 18 | results => { 19 | room.subscriptionPrefix(2); 20 | if (!!results && results.length > 0) { 21 | results.forEach(({ }) => { 22 | 23 | room.assert(`wish circuit playground neopixel 0 had color 100 0 0`) 24 | 25 | 26 | }); 27 | } 28 | room.subscriptionPostfix(); 29 | }) 30 | 31 | 32 | run(); 33 | -------------------------------------------------------------------------------- /src/programs/2014__blank.prejs: -------------------------------------------------------------------------------- 1 | when circuit playground "BUTTON_A" has value 0: 2 | 3 | claim wish circuit playground neopixel 0 had color 0 0 0 4 | 5 | end 6 | 7 | when circuit playground "BUTTON_A" has value 1: 8 | 9 | claim wish circuit playground neopixel 0 had color 100 0 0 10 | -------------------------------------------------------------------------------- /src/programs/2015__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`wish circuit playground neopixel 9 had color 0 0 0`) 4 | 5 | room.on(`there is a cat`, 6 | results => { 7 | room.subscriptionPrefix(1); 8 | if (!!results && results.length > 0) { 9 | results.forEach(({ }) => { 10 | 11 | room.assert(`wish circuit playground neopixel 9 had color 100 50 0`) 12 | 13 | 14 | }); 15 | } else { 16 | 17 | room.assert(`wish circuit playground neopixel 9 had color 0 0 0`) 18 | 19 | 20 | } 21 | room.subscriptionPostfix(); 22 | }) 23 | 24 | 25 | run(); 26 | -------------------------------------------------------------------------------- /src/programs/2015__blank.prejs: -------------------------------------------------------------------------------- 1 | claim wish circuit playground neopixel 9 had color 0 0 0 2 | 3 | when there is a cat: 4 | 5 | claim wish circuit playground neopixel 9 had color 100 50 0 6 | 7 | otherwise: 8 | 9 | claim wish circuit playground neopixel 9 had color 0 0 0 10 | 11 | -------------------------------------------------------------------------------- /src/programs/2016__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`there is a cat`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ }) => { 8 | room.assert(`i see a cat`) 9 | 10 | 11 | }); 12 | } 13 | room.subscriptionPostfix(); 14 | }) 15 | 16 | 17 | run(); 18 | -------------------------------------------------------------------------------- /src/programs/2016__blank.prejs: -------------------------------------------------------------------------------- 1 | when there is a cat: 2 | claim i see a cat 3 | -------------------------------------------------------------------------------- /src/programs/2017__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`there is a cat`) 4 | 5 | 6 | 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/2017__blank.prejs: -------------------------------------------------------------------------------- 1 | claim there is a cat 2 | -------------------------------------------------------------------------------- /src/programs/2018__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`circuit playground LIGHT has value $x`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ x }) => { 8 | 9 | let y = x > 100 ? 200 : 0 10 | 11 | room.assert(`wish circuit playground neopixel 2 had color ${y} 0 0`) 12 | 13 | 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/2018__blank.prejs: -------------------------------------------------------------------------------- 1 | when circuit playground LIGHT has value $x: 2 | 3 | let y = x > 100 ? 200 : 0 4 | 5 | claim wish circuit playground neopixel 2 had color ${y} 0 0 6 | -------------------------------------------------------------------------------- /src/programs/2019__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`wish circuit playground played 440 tone`) 4 | 5 | 6 | 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/2019__blank.prejs: -------------------------------------------------------------------------------- 1 | claim wish circuit playground played 440 tone 2 | -------------------------------------------------------------------------------- /src/programs/2020__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | setInterval(() => { 4 | room.cleanup() 5 | room.assert(`time is ${Math.round((new Date()).getTime()/1000)}`) 6 | room.flush() 7 | }, 800) 8 | 9 | 10 | 11 | 12 | run(); 13 | -------------------------------------------------------------------------------- /src/programs/2020__blank.prejs: -------------------------------------------------------------------------------- 1 | setInterval(() => { 2 | cleanup 3 | claim time is ${Math.round((new Date()).getTime()/1000)} 4 | room.flush() 5 | }, 800) 6 | -------------------------------------------------------------------------------- /src/programs/2021__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`time is $t`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ t }) => { 8 | 9 | if ((t % 5) === 0) { 10 | room.assert(`wish circuit playground played 440 tone`) 11 | } 12 | 13 | 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/2021__blank.prejs: -------------------------------------------------------------------------------- 1 | when time is $t: 2 | 3 | if ((t % 5) === 0) { 4 | claim wish circuit playground played 440 tone 5 | } 6 | -------------------------------------------------------------------------------- /src/programs/2022__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`count is $x`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ x }) => { 8 | 9 | for (let i=0; i<10; i+=1) { 10 | let v = (x % 10 == i) ? 10 : 0; 11 | room.assert(`wish circuit playground neopixel ${i} had color 0 ${v} 0`) 12 | } 13 | 14 | 15 | }); 16 | } 17 | room.subscriptionPostfix(); 18 | }) 19 | 20 | 21 | run(); 22 | -------------------------------------------------------------------------------- /src/programs/2022__blank.prejs: -------------------------------------------------------------------------------- 1 | when count is $x: 2 | 3 | for (let i=0; i<10; i+=1) { 4 | let v = (x % 10 == i) ? 10 : 0; 5 | claim wish circuit playground neopixel ${i} had color 0 ${v} 0 6 | } 7 | -------------------------------------------------------------------------------- /src/programs/2023__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`time is $t`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ t }) => { 8 | 9 | for (let i=0; i<10; i+=1) { 10 | let x = ((t % 10) >= 5) ? 5 : 0; 11 | let y = ((t % 10) >= 5) ? 0 : 5; 12 | let v = (i>=5) ? x : y; 13 | room.assert(`wish circuit playground neopixel ${i} had color ${v} ${v} ${v}`) 14 | } 15 | 16 | }); 17 | } 18 | room.subscriptionPostfix(); 19 | }) 20 | 21 | 22 | run(); 23 | -------------------------------------------------------------------------------- /src/programs/2023__blank.prejs: -------------------------------------------------------------------------------- 1 | when time is $t: 2 | 3 | for (let i=0; i<10; i+=1) { 4 | let x = ((t % 10) >= 5) ? 5 : 0; 5 | let y = ((t % 10) >= 5) ? 0 : 5; 6 | let v = (i>=5) ? x : y; 7 | claim wish circuit playground neopixel ${i} had color ${v} ${v} ${v} 8 | } -------------------------------------------------------------------------------- /src/programs/2024.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.cleanup() 4 | let ill = room.newIllumination() 5 | ill.fill("green") 6 | ill.rect(0, 0, 1920, 1080) 7 | room.draw(ill, "1998") 8 | 9 | 10 | 11 | 12 | 13 | run(); 14 | -------------------------------------------------------------------------------- /src/programs/2024.prejs: -------------------------------------------------------------------------------- 1 | cleanup 2 | let ill = room.newIllumination() 3 | ill.fill("green") 4 | ill.rect(0, 0, 1920, 1080) 5 | room.draw(ill, "1998") 6 | 7 | -------------------------------------------------------------------------------- /src/programs/2025.prejs: -------------------------------------------------------------------------------- 1 | cleanup 2 | let S = 150 3 | let petals = 7 4 | let ill = room.newIllumination() 5 | ill.push() 6 | ill.translate(500, 400) 7 | ill.nofill() 8 | ill.strokewidth(4) 9 | ill.stroke("white") 10 | for (let i=0; i { 7 | room.subscriptionPrefix(1); 8 | if (!!results) { 9 | results.forEach(({ t, x }) => { 10 | if (log.length == 0 || log[log.length-1].activity != x) { 11 | log.push({"time": t, "activity": x}) 12 | } 13 | let ill = room.newIllumination() 14 | ill.fontcolor("white") 15 | ill.fontsize(100) 16 | log.forEach((l, i) => { 17 | let tText = (new Date(l.time)).toLocaleTimeString() 18 | ill.text(100, 100 + i*100, `[${tText}] ${l.activity}`) 19 | }) 20 | room.draw(ill) 21 | 22 | 23 | }); 24 | } 25 | room.subscriptionPostfix(); 26 | }) 27 | 28 | 29 | run(); 30 | -------------------------------------------------------------------------------- /src/programs/2026.prejs: -------------------------------------------------------------------------------- 1 | log = [] 2 | when time is $t, 3 | activity is $x: 4 | if (log.length == 0 || log[log.length-1].activity != x) { 5 | log.push({"time": t, "activity": x}) 6 | } 7 | let ill = room.newIllumination() 8 | ill.fontcolor("white") 9 | ill.fontsize(100) 10 | log.forEach((l, i) => { 11 | let tText = (new Date(l.time)).toLocaleTimeString() 12 | ill.text(100, 100 + i*100, `[${tText}] ${l.activity}`) 13 | }) 14 | room.draw(ill) 15 | -------------------------------------------------------------------------------- /src/programs/2027.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`calendar $ calibration for $displayId is $M1 $M2 $M3 $M4 $M5 $M6 $M7 $M8 $M9`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ displayId, M1, M2, M3, M4, M5, M6, M7, M8, M9 }) => { 8 | 9 | room.cleanup() 10 | let W = 1280 11 | let H = 720 12 | let ill = room.newIllumination() 13 | ill.set_transform(+M1, +M2, +M3, +M4, +M5, +M6, +M7, +M8, +M9) 14 | ill.fill("red") 15 | for (let x=0; x<7; x+=1) { 16 | for (let y=0; y<5; y+=1) { 17 | if ((x+y) % 2 === 0) { 18 | ill.rect(x*W/7, y*H/5, W/7, H/5) 19 | } 20 | } 21 | } 22 | room.draw(ill, displayId) 23 | 24 | 25 | }); 26 | } 27 | room.subscriptionPostfix(); 28 | }) 29 | 30 | 31 | run(); 32 | -------------------------------------------------------------------------------- /src/programs/2027.prejs: -------------------------------------------------------------------------------- 1 | when calendar $ calibration for $displayId is $M1 $M2 $M3 $M4 $M5 $M6 $M7 $M8 $M9: 2 | 3 | cleanup 4 | let W = 1280 5 | let H = 720 6 | let ill = room.newIllumination() 7 | ill.set_transform(+M1, +M2, +M3, +M4, +M5, +M6, +M7, +M8, +M9) 8 | ill.fill("red") 9 | for (let x=0; x<7; x+=1) { 10 | for (let y=0; y<5; y+=1) { 11 | if ((x+y) % 2 === 0) { 12 | ill.rect(x*W/7, y*H/5, W/7, H/5) 13 | } 14 | } 15 | } 16 | room.draw(ill, displayId) 17 | -------------------------------------------------------------------------------- /src/programs/2029.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`wish plant lamp was at 100 percent`) 4 | 5 | 6 | 7 | 8 | 9 | run(); 10 | -------------------------------------------------------------------------------- /src/programs/2029.prejs: -------------------------------------------------------------------------------- 1 | claim wish plant lamp was at 100 percent 2 | 3 | -------------------------------------------------------------------------------- /src/programs/2030.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`I am a turtle card`) 4 | 5 | 6 | 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/2030.prejs: -------------------------------------------------------------------------------- 1 | claim I am a turtle card 2 | -------------------------------------------------------------------------------- /src/programs/2031.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | let lowMoisture = 500; 4 | let highMoisture = 1000; 5 | 6 | room.on(`Photon says "SOIL_MOISTURE" is $M`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results && results.length > 0) { 10 | results.forEach(({ M }) => { 11 | 12 | let P = 100 * (M - lowMoisture) / (highMoisture - lowMoisture) 13 | P = Math.floor(Math.min(100, Math.max(0, P))) 14 | P = 100 - P 15 | // invert so lamp is bright when soil is dry 16 | room.assert(`wish plant lamp was at ${P} percent`) 17 | 18 | 19 | }); 20 | } 21 | room.subscriptionPostfix(); 22 | }) 23 | 24 | 25 | run(); 26 | -------------------------------------------------------------------------------- /src/programs/2031.prejs: -------------------------------------------------------------------------------- 1 | let lowMoisture = 500; 2 | let highMoisture = 1000; 3 | 4 | when Photon says "SOIL_MOISTURE" is $M: 5 | 6 | let P = 100 * (M - lowMoisture) / (highMoisture - lowMoisture) 7 | P = Math.floor(Math.min(100, Math.max(0, P))) 8 | P = 100 - P 9 | // invert so lamp is bright when soil is dry 10 | claim wish plant lamp was at ${P} percent 11 | -------------------------------------------------------------------------------- /src/programs/2033.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`I am a pen card`) 4 | 5 | 6 | 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/2033.prejs: -------------------------------------------------------------------------------- 1 | claim I am a pen card 2 | -------------------------------------------------------------------------------- /src/programs/2034.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`I am a rainbow card`) 4 | 5 | 6 | 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/2034.prejs: -------------------------------------------------------------------------------- 1 | claim I am a rainbow card 2 | -------------------------------------------------------------------------------- /src/programs/2035.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`I am a spiral card`) 4 | 5 | 6 | 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/2035.prejs: -------------------------------------------------------------------------------- 1 | claim I am a spiral card 2 | -------------------------------------------------------------------------------- /src/programs/2036.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`I am a emitter card`) 4 | 5 | 6 | 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/2036.prejs: -------------------------------------------------------------------------------- 1 | claim I am a emitter card 2 | -------------------------------------------------------------------------------- /src/programs/2037.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | let ill = room.newIllumination() 4 | ill.nostroke() 5 | ill.fill(200, 200, 128) 6 | ill.rect(0, 0, 1024, 600) 7 | ill.fontcolor(0, 0, 0) 8 | ill.fontsize(60) 9 | ill.text(20, 20, "Muffins") 10 | ill.fontsize(20) 11 | ill.text(20, 100, "2 Cups Flour") 12 | ill.text(20, 125, "3 teaspoons baking powder") 13 | ill.text(20, 150, "1/2 teaspoon salt") 14 | ill.text(20, 175, "3/4 cup white sugar") 15 | ill.text(20, 200, "1 egg") 16 | ill.text(20, 225, "1 cup milk") 17 | ill.text(20, 250, "1/4 cup vegetable oil") 18 | room.draw(ill) 19 | 20 | 21 | 22 | 23 | run(); 24 | -------------------------------------------------------------------------------- /src/programs/2037.prejs: -------------------------------------------------------------------------------- 1 | let ill = room.newIllumination() 2 | ill.nostroke() 3 | ill.fill(200, 200, 128) 4 | ill.rect(0, 0, 1024, 600) 5 | ill.fontcolor(0, 0, 0) 6 | ill.fontsize(60) 7 | ill.text(20, 20, "Muffins") 8 | ill.fontsize(20) 9 | ill.text(20, 100, "2 Cups Flour") 10 | ill.text(20, 125, "3 teaspoons baking powder") 11 | ill.text(20, 150, "1/2 teaspoon salt") 12 | ill.text(20, 175, "3/4 cup white sugar") 13 | ill.text(20, 200, "1 egg") 14 | ill.text(20, 225, "1 cup milk") 15 | ill.text(20, 250, "1/4 cup vegetable oil") 16 | room.draw(ill) 17 | -------------------------------------------------------------------------------- /src/programs/2039.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | let minuteDelay = 5; 4 | 5 | room.on(`time is $t`, 6 | results => { 7 | room.subscriptionPrefix(1); 8 | if (!!results && results.length > 0) { 9 | results.forEach(({ t }) => { 10 | 11 | let offset = t % (60*minuteDelay); 12 | if (offset === 0) { 13 | room.assert(`wish ribbon moved every 50 ms`) 14 | } else if (offset == 5) { 15 | room.assert(`wish ribbon moved every 1000 ms`) 16 | } 17 | 18 | 19 | }); 20 | } 21 | room.subscriptionPostfix(); 22 | }) 23 | 24 | 25 | run(); 26 | -------------------------------------------------------------------------------- /src/programs/2039.prejs: -------------------------------------------------------------------------------- 1 | let minuteDelay = 5; 2 | 3 | when time is $t: 4 | 5 | let offset = t % (60*minuteDelay); 6 | if (offset === 0) { 7 | claim wish ribbon moved every 50 ms 8 | } else if (offset == 5) { 9 | claim wish ribbon moved every 1000 ms 10 | } 11 | -------------------------------------------------------------------------------- /src/programs/2041.prejs: -------------------------------------------------------------------------------- 1 | var C = [1,0,0,0,1,0,0,0,1]; 2 | var D = "1997"; 3 | 4 | when sticky $ calibration for $displayId is $M1 $M2 $M3 $M4 $M5 $M6 $M7 $M8 $M9: 5 | C = [+M1, +M2, +M3, +M4, +M5, +M6, +M7, +M8, +M9] 6 | D = `${displayId}`; 7 | end 8 | 9 | when laser in region $r, 10 | region $r has name sticky: 11 | let ill = room.newIllumination() 12 | ill.set_transform(C[0], C[1], C[2], C[3], C[4], C[5], C[6], C[7], C[8], C[9]) 13 | ill.fontsize(150); 14 | ill.text(100, 200, "That's my sticky!") 15 | room.draw(ill, D) 16 | -------------------------------------------------------------------------------- /src/programs/2042.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`draw graphics $graphics on 1101`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ graphics }) => { 8 | 9 | room.assert(`draw graphics`, ["text", graphics], `on web2`) 10 | 11 | 12 | }); 13 | } 14 | room.subscriptionPostfix(); 15 | }) 16 | 17 | 18 | run(); 19 | -------------------------------------------------------------------------------- /src/programs/2042.prejs: -------------------------------------------------------------------------------- 1 | when draw graphics $graphics on 1101: 2 | 3 | claim draw graphics`, ["text", graphics], `on web2 4 | -------------------------------------------------------------------------------- /src/programs/2044.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`time is $time`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ time }) => { 8 | 9 | let d = new Date(time*1000) 10 | let timeString = d.toLocaleTimeString('en-US', { 11 | hour: '2-digit', minute: '2-digit' 12 | }); 13 | let ill = room.newIllumination(); 14 | ill.fontcolor(150, 100, 100); 15 | ill.fontsize(200); 16 | ill.text(20, 160, timeString); 17 | room.draw(ill); 18 | 19 | 20 | }); 21 | } 22 | room.subscriptionPostfix(); 23 | }) 24 | 25 | 26 | run(); 27 | -------------------------------------------------------------------------------- /src/programs/2044.prejs: -------------------------------------------------------------------------------- 1 | when time is $time: 2 | 3 | let d = new Date(time*1000) 4 | let timeString = d.toLocaleTimeString('en-US', { 5 | hour: '2-digit', minute: '2-digit' 6 | }); 7 | let ill = room.newIllumination(); 8 | ill.fontcolor(150, 100, 100); 9 | ill.fontsize(200); 10 | ill.text(20, 160, timeString); 11 | room.draw(ill); 12 | -------------------------------------------------------------------------------- /src/programs/210.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`I wish I was highlighted red`) 4 | 5 | 6 | 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/210.prejs: -------------------------------------------------------------------------------- 1 | claim I wish I was highlighted red 2 | -------------------------------------------------------------------------------- /src/programs/231.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | data = [] 4 | size = 18 5 | 6 | room.onRaw(`$ $ paper ${myId} is pointing at paper $id`, 7 | `$ $ paper $id has id $fullId`, 8 | `$fullId $ $name is $value`, 9 | results => { 10 | room.subscriptionPrefix(1); 11 | if (!!results) { 12 | results.forEach(({ id, fullId, name, value }) => { 13 | data.push(value) 14 | data = data.slice(-size) 15 | room.assert(`"${id}'s ${name}" data is "${data.toString()}"`) 16 | }); 17 | let ill = room.newIllumination() 18 | ill.fontsize(8) 19 | for (let i=0; i { 8 | room.subscriptionPrefix(1); 9 | if (!!results) { 10 | results.forEach(({ time }) => { 11 | let value = lastValue + 1; 12 | if (value > maxValue) { 13 | value = 0; 14 | } 15 | let ill = room.newIllumination() 16 | const fontSize = 25; 17 | ill.fontsize(fontSize) 18 | ill.text(0, 0, `${value}`) 19 | room.draw(ill) 20 | room.assert(`value is ${value}`) 21 | lastValue = value; 22 | }); 23 | } 24 | room.subscriptionPostfix(); 25 | }) 26 | 27 | 28 | run(); 29 | -------------------------------------------------------------------------------- /src/programs/2__test.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | let N = 100 4 | let i = 1 5 | 6 | room.on( 7 | `$X ${myId} has $Y toes`, 8 | results => { 9 | room.cleanup() 10 | console.log("results:") 11 | console.log(results) 12 | i += 1; 13 | if (i >= N) { 14 | console.log("\n...DONE!") 15 | process.exit(0); 16 | } 17 | room.assert(`Man ${myId} has ${i} toes`) 18 | room.assert(`Man ${myId} has ${i} toes`) 19 | room.assert(`Hello`, ["text", "world"], "$") 20 | } 21 | ) 22 | 23 | room.assert(`Man ${myId} has 0 toes`) 24 | room.assert(`Hello`, ["text", "world"], "$") 25 | 26 | run(); -------------------------------------------------------------------------------- /src/programs/33__tablet-humidity.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on( 4 | `$photon says the humidity is $humidity and temp is $temp`, 5 | results => { 6 | 7 | // room.cleanup() 8 | console.log("results:") 9 | console.log(results) 10 | 11 | room.cleanup(); 12 | if (!results || results.length === 0) { 13 | room.assert(`wish tablet would show`, ["text", `How humid is it?`]) 14 | } else { 15 | room.assert(`wish tablet would show`, ["text", `Humidity is ${results[0].humidity}.`]) 16 | } 17 | } 18 | ) 19 | 20 | room.assert(`wish tablet would show`, ["text", `How humid is it?`]) 21 | 22 | run(); -------------------------------------------------------------------------------- /src/programs/34__tablet-color.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on( 4 | `$photon sees color ( $r, $g, $b )`, 5 | results => { 6 | console.log("results:") 7 | console.log(results) 8 | room.cleanup(); 9 | if (!results || results.length === 0) { 10 | room.assert(`wish tablet had background color ( 0 , 0 , 0 )`) 11 | } else { 12 | let r = results[0].r; 13 | let g = results[0].g; 14 | let b = results[0].b; 15 | room.assert(`wish tablet had background color ( ${r} , ${g} , ${b} )`) 16 | } 17 | } 18 | ) 19 | 20 | run(); -------------------------------------------------------------------------------- /src/programs/35__strand-light-color.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on( 4 | `$photon sees color ( $r, $g, $b )`, 5 | results => { 6 | console.log("results:") 7 | console.log(results) 8 | room.cleanup(); 9 | if (!results || results.length === 0) { 10 | room.assert(`wish RGB light strand is color 10 0 0`) 11 | } else { 12 | let r = results[0].r; 13 | let g = results[0].g; 14 | let b = results[0].b; 15 | let scale = x => Math.floor(x*0.3); 16 | room.assert(`wish RGB light strand is color ${scale(r)} ${scale(g)} ${scale(b)}`) 17 | } 18 | } 19 | ) 20 | 21 | run(); -------------------------------------------------------------------------------- /src/programs/395__taco.js: -------------------------------------------------------------------------------- 1 | const { room, myId } = require('../helper')(__filename); 2 | 3 | console.log("start taco") 4 | room.retractMine(`hello from taco @ $`) 5 | 6 | setInterval(() => { 7 | console.error("hello from taco", new Date()) 8 | room 9 | .retractMine(`hello from taco @ $`) 10 | .assert(`hello from taco @ ${(new Date()).getTime()}`) 11 | }, 1000); 12 | -------------------------------------------------------------------------------- /src/programs/45__runSeenRFID.prejs: -------------------------------------------------------------------------------- 1 | when $photonId read $value on sensor $sensorId, 2 | paper $paperId has RFID $value: 3 | claim wish ${paperId} would be running 4 | claim default display for ${paperId} is 1999 5 | claim paper ${paperId} has width ${1024} height ${600} angle 0 at (0, 0) 6 | 7 | when Photone00fce68c89828cc20a8607b read $value on sensor 4, 8 | paper $paperId has RFID $value: 9 | claim paper 1013 is pointing at paper ${paperId} 10 | 11 | when ArgonBLE read $value on sensor 1, 12 | paper $paperId has RFID $value: 13 | claim paper 1013 is pointing at paper ${paperId} 14 | -------------------------------------------------------------------------------- /src/programs/498__printingManager.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import logging 3 | from helper import init, claim, retract, prehook, subscription, batch, get_my_id_str 4 | 5 | @subscription(["$ $ wish file $name would be printed"]) 6 | def sub_callback(results): 7 | claims = [] 8 | claims.append({"type": "retract", "fact": [ 9 | ["variable", ""], 10 | ["variable", ""], 11 | ["text", "wish"], 12 | ["text", "file"], 13 | ["variable", ""], 14 | ["text", "would"], 15 | ["text", "be"], 16 | ["text", "printed"], 17 | ]}) 18 | batch(claims) 19 | for result in results: 20 | name = result["name"] 21 | logging.info("PRINTING:") 22 | logging.info(name) 23 | subprocess.call(['/usr/bin/lpr', name]) 24 | 25 | init(__file__) 26 | -------------------------------------------------------------------------------- /src/programs/502.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`Photon says "SOIL_TEMP" is $t`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results && results.length > 0) { 7 | results.forEach(({ t }) => { 8 | let ill = room.newIllumination() 9 | ill.text(0, 0, "test") 10 | let lat = -71.1034; 11 | let long = 42.3834; 12 | let zoom = 15.0*t/4082.0; 13 | let access_token = process.env.MAPBOX_TOKEN; 14 | let u = `https://api.mapbox.com` + 15 | `/styles/v1/mapbox/streets-v11/static/` + 16 | `${lat},${long},${zoom},0/` + 17 | `300x200` + 18 | `?access_token=${access_token}` 19 | ill.image(30, 30, 360*2, 240*2, u) 20 | room.draw(ill) 21 | 22 | 23 | }); 24 | } 25 | room.subscriptionPostfix(); 26 | }) 27 | 28 | 29 | run(); 30 | -------------------------------------------------------------------------------- /src/programs/502.prejs: -------------------------------------------------------------------------------- 1 | when Photon says "SOIL_TEMP" is $t: 2 | let ill = room.newIllumination() 3 | ill.text(0, 0, "test") 4 | let lat = -71.1034; 5 | let long = 42.3834; 6 | let zoom = 15.0*t/4082.0; 7 | let access_token = process.env.MAPBOX_TOKEN; 8 | let u = `https://api.mapbox.com` + 9 | `/styles/v1/mapbox/streets-v11/static/` + 10 | `${lat},${long},${zoom},0/` + 11 | `300x200` + 12 | `?access_token=${access_token}` 13 | ill.image(30, 30, 360*2, 240*2, u) 14 | room.draw(ill) 15 | -------------------------------------------------------------------------------- /src/programs/5__test.py: -------------------------------------------------------------------------------- 1 | import time 2 | import logging 3 | import math 4 | import datetime 5 | from helper import init, claim, retract, prehook, subscription, batch, get_my_id_str 6 | 7 | 8 | @subscription(["$ $ $X 5 has $Y toes"]) 9 | def sub_callback_papers(results): 10 | logging.error("RESULTS:") 11 | logging.error(results) 12 | 13 | @prehook 14 | def my_prehook(): 15 | claims = [] 16 | claims.append({"type": "claim", "fact": [ 17 | ["id", get_my_id_str()], 18 | ["id", "0"], 19 | ["text", "Man"], 20 | ["integer", "5"], 21 | ["text", "has"], 22 | ["integer", "0"], 23 | ["text", "toes"], 24 | ]}) 25 | batch(claims) 26 | 27 | init(__file__) 28 | -------------------------------------------------------------------------------- /src/programs/631.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | data = [] 4 | size = 20 5 | 6 | room.on(`$ says the humidity is $h and temp is $t`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results) { 10 | results.forEach(({ h, t }) => { 11 | data.push(h) 12 | if (data.length > size) { 13 | data = data.slice(-size) 14 | } 15 | room.assert(`"Humidity" data is "${data.toString()}"`) 16 | 17 | }); 18 | } 19 | room.subscriptionPostfix(); 20 | }) 21 | 22 | 23 | run(); 24 | -------------------------------------------------------------------------------- /src/programs/631.prejs: -------------------------------------------------------------------------------- 1 | data = [] 2 | size = 20 3 | 4 | when $ says the humidity is $h and temp is $t: 5 | data.push(h) 6 | if (data.length > size) { 7 | data = data.slice(-size) 8 | } 9 | claim "Humidity" data is "${data.toString()}" -------------------------------------------------------------------------------- /src/programs/676.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | 4 | room.on(`button was pressed @ $t`, 5 | results => { 6 | room.subscriptionPrefix(1); 7 | if (!!results) { 8 | results.forEach(({ t }) => { 9 | room.assert(`I wish I was highlighted green`) 10 | setTimeout(() => { 11 | room.cleanup() 12 | room.flush() 13 | }, 500); 14 | 15 | }); 16 | } 17 | room.subscriptionPostfix(); 18 | }) 19 | 20 | 21 | run(); 22 | -------------------------------------------------------------------------------- /src/programs/676.prejs: -------------------------------------------------------------------------------- 1 | 2 | when button was pressed @ $t: 3 | claim I wish I was highlighted green 4 | setTimeout(() => { 5 | cleanup 6 | room.flush() 7 | }, 500); -------------------------------------------------------------------------------- /src/programs/716__logReader.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const readline = require('readline'); 3 | const { room, myId, scriptName } = require('../helper')(__filename); 4 | 5 | console.log("start testProcess") 6 | 7 | const targetProcess = 'testProcess' 8 | const readLogPath = __filename.replace(scriptName, `logs/${targetProcess}.log`) 9 | const rl = readline.createInterface({ 10 | input: fs.createReadStream(readLogPath), 11 | crlfDelay: Infinity 12 | }); 13 | 14 | rl.on('line', (line) => { 15 | console.log(`Line from file: ${line}`); 16 | }); 17 | -------------------------------------------------------------------------------- /src/programs/759.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`wish 1632 would be running`); 4 | 5 | run(); 6 | -------------------------------------------------------------------------------- /src/programs/770__melody1.js: -------------------------------------------------------------------------------- 1 | const {room, myId, scriptName, run} = require('../helpers/helper')(__filename) 2 | 3 | room.cleanup() 4 | room.assert("melody is", ["text", "60,62,64,66,68,66,64,62"]) 5 | // room.assert("melody is", ["text", ""]) 6 | room.assert("beats per minute is 212") 7 | room.assert("instrument is 100") 8 | 9 | run() -------------------------------------------------------------------------------- /src/programs/771__change-bpm-1.js: -------------------------------------------------------------------------------- 1 | const { room, myId, scriptName, run } = require('../helpers/helper')(__filename) 2 | 3 | room.cleanup() 4 | room.retractAll("beats per minute is $") 5 | room.assert("beats per minute is 60") 6 | 7 | run() -------------------------------------------------------------------------------- /src/programs/772__change-bpm-2.js: -------------------------------------------------------------------------------- 1 | const { room, myId, scriptName, run } = require('../helpers/helper')(__filename) 2 | 3 | room.cleanup() 4 | room.retractAll("beats per minute is $") 5 | room.assert("beats per minute is 500") 6 | 7 | run() -------------------------------------------------------------------------------- /src/programs/773__change-instrument-1.js: -------------------------------------------------------------------------------- 1 | const { room, myId, scriptName, run } = require('../helpers/helper')(__filename) 2 | 3 | room.cleanup() 4 | room.retractAll("instrument is $") 5 | room.assert("instrument is 100") 6 | 7 | run() -------------------------------------------------------------------------------- /src/programs/774__change-instrument-2.js: -------------------------------------------------------------------------------- 1 | const { room, myId, scriptName, run } = require('../helpers/helper')(__filename) 2 | 3 | room.cleanup() 4 | room.retractAll("instrument is $") 5 | room.assert("instrument is 19") 6 | 7 | run() -------------------------------------------------------------------------------- /src/programs/775__change-melody-1.js: -------------------------------------------------------------------------------- 1 | const { room, myId, scriptName, run } = require('../helpers/helper')(__filename) 2 | 3 | room.cleanup() 4 | room.retractAll("melody is $") 5 | room.assert("melody is", ["text", "60,62,64,66,68,66,64,62"]) 6 | 7 | run() -------------------------------------------------------------------------------- /src/programs/776__change-melody-2.js: -------------------------------------------------------------------------------- 1 | const { room, myId, scriptName, run } = require('../helpers/helper')(__filename) 2 | 3 | room.cleanup() 4 | room.retractAll("melody is $") 5 | room.assert("melody is", ["text", "50,54,50,50,60"]) 6 | 7 | run() -------------------------------------------------------------------------------- /src/programs/778__bpm-by-rotation.js: -------------------------------------------------------------------------------- 1 | const { room, myId, scriptName, run } = require('../helpers/helper')(__filename) 2 | 3 | room.on( 4 | `paper ${myId} has width $ height $ angle $angleRadians at ( $ , $ )`, 5 | results => { 6 | room.cleanup() 7 | room.retractAll("beats per minute is $") 8 | try { 9 | const angleRadians = parseFloat(results[0]["angleRadians"]) 10 | const angleAsPercentageOfRange = (angleRadians + Math.PI) / (2.0 * Math.PI) 11 | const beatsPerMinuteMin = 30 12 | const beatsPerMinuteMax = 1000 13 | const beatsPerMinute = beatsPerMinuteMin + angleAsPercentageOfRange * (beatsPerMinuteMax - beatsPerMinuteMin) 14 | room.assert(`beats per minute is ${parseInt(beatsPerMinute)}`) 15 | } catch (e) { 16 | console.error(e) 17 | } 18 | } 19 | ) -------------------------------------------------------------------------------- /src/programs/793__textToSpeech.js: -------------------------------------------------------------------------------- 1 | const spawn = require('child_process').spawn; 2 | const { room, myId, run, MY_ID_STR, getIdFromProcessName, getIdStringFromId } = require('../helpers/helper')(__filename); 3 | 4 | room.onGetSource('wisherId', 5 | `wish speaker said $text`, 6 | results => { 7 | room.subscriptionPrefix(1); 8 | if (!!results && results.length > 0) { 9 | results.forEach(({ wisherId, text }) => { 10 | runArgs = ["-voice", "rms", "-t", text] 11 | console.log(runArgs) 12 | const child = spawn('flite', runArgs) 13 | console.log("done") 14 | room.retractFromSource(wisherId, `wish speaker said $`) 15 | }); 16 | } 17 | room.subscriptionPostfix(); 18 | }) 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/795.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.assert(`I wish I was highlighted yellow`) 4 | 5 | 6 | 7 | 8 | run(); 9 | -------------------------------------------------------------------------------- /src/programs/795.prejs: -------------------------------------------------------------------------------- 1 | claim I wish I was highlighted yellow 2 | -------------------------------------------------------------------------------- /src/programs/826__runSeenPapers.js: -------------------------------------------------------------------------------- 1 | const { room, myId, scriptName, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on( 4 | `camera $cameraId sees paper $id at TL ( $ , $ ) TR ( $ , $ ) BR ( $ , $ ) BL ( $ , $ ) @ $time`, 5 | results => { 6 | room.cleanup(); 7 | (results || []).forEach(result => { 8 | room.assert(`wish ${String(result.id)} would be running`); 9 | }); 10 | } 11 | ) 12 | -------------------------------------------------------------------------------- /src/programs/8__blank.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | // Write code here! 4 | -------------------------------------------------------------------------------- /src/programs/909__laserSocksReferee.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`laser in region $regionId @ $t`, 4 | `region $regionId has name $regionName`, 5 | results => { 6 | room.subscriptionPrefix(1); 7 | if (!!results) { 8 | results.forEach(({ regionId, t, regionName }) => { 9 | if (regionName === "p1area") { 10 | room.assert(`player 1 scored @ ${t}`) 11 | } else if (regionName === "p2area") { 12 | room.assert(`player 2 scored @ ${t}`) 13 | } 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | run(); 20 | -------------------------------------------------------------------------------- /src/programs/911__laserRegionToLaserCal.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | const LASER_CAMERA_ID = 2; 4 | 5 | room.on(`region $regionId at $x1 $y1 $x2 $y2 $x3 $y3 $x4 $y4`, 6 | `region $regionId has name lasercal`, 7 | results => { 8 | room.subscriptionPrefix(1); 9 | if (!!results) { 10 | results.forEach(({ regionId, x1, y1, x2, y2, x3, y3, x4, y4 }) => { 11 | room.retractAll(`camera ${LASER_CAMERA_ID} has projector calibration %`); 12 | let currentTime = (new Date()).getTime() / 1000; 13 | room.assert(`camera ${LASER_CAMERA_ID} has projector calibration TL ( ${x1} , ${y1} ) TR ( ${x2} , ${y2} ) BR ( ${x3} , ${y3} ) BL ( ${x4} , ${y4} ) @ ${currentTime}`); 14 | }); 15 | } 16 | room.subscriptionPostfix(); 17 | }) 18 | 19 | 20 | run(); 21 | -------------------------------------------------------------------------------- /src/programs/958.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | function draw(v) { 4 | let ill = room.newIllumination() 5 | ill.nofill() 6 | ill.stroke(255, 0, 0) 7 | ill.strokewidth(5) 8 | ill.rect(50, 300+1080, 500, 100) 9 | ill.fill(255, 0, 0) 10 | ill.rect(50, 300+1080, 500*v, 100) 11 | if (v > 0.99) { 12 | ill.fontcolor(255, 255, 0) 13 | ill.fontsize(80) 14 | ill.text(55, 300+1080, "Gas is full") 15 | } 16 | room.draw(ill, "1567") 17 | } 18 | 19 | room.on(`Photon says "SOIL_TEMP" is $t`, 20 | results => { 21 | room.subscriptionPrefix(1); 22 | if (!!results && results.length > 0) { 23 | results.forEach(({ t }) => { 24 | draw(t/4082) 25 | 26 | }); 27 | } 28 | room.subscriptionPostfix(); 29 | }) 30 | 31 | 32 | 33 | run(); 34 | -------------------------------------------------------------------------------- /src/programs/958.prejs: -------------------------------------------------------------------------------- 1 | function draw(v) { 2 | let ill = room.newIllumination() 3 | ill.nofill() 4 | ill.stroke(255, 0, 0) 5 | ill.strokewidth(5) 6 | ill.rect(50, 300+1080, 500, 100) 7 | ill.fill(255, 0, 0) 8 | ill.rect(50, 300+1080, 500*v, 100) 9 | if (v > 0.99) { 10 | ill.fontcolor(255, 255, 0) 11 | ill.fontsize(80) 12 | ill.text(55, 300+1080, "Gas is full") 13 | } 14 | room.draw(ill, "1567") 15 | } 16 | 17 | when Photon says "SOIL_TEMP" is $t: 18 | draw(t/4082) 19 | end -------------------------------------------------------------------------------- /src/programs/980__thermalPrintCode.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on( 4 | `wish paper $id at $shortFilename would be printed`, 5 | `$shortFilename has source code $sourceCode`, 6 | results => { 7 | room.subscriptionPrefix(1); 8 | if (!!results) { 9 | room.retractAll(`wish paper $ at $ would be printed`); 10 | results.forEach(({ id, shortFilename, sourceCode }) => { 11 | room.assert(`wish text`, ["text", `Code for ${id}:\n\n${sourceCode}`], `would be thermal printed`) 12 | }); 13 | } 14 | room.subscriptionPostfix(); 15 | }) 16 | 17 | 18 | run(); 19 | -------------------------------------------------------------------------------- /src/programs/993.js: -------------------------------------------------------------------------------- 1 | const { room, myId, run } = require('../helpers/helper')(__filename); 2 | 3 | room.on(`paper ${myId} has width $width height $height angle $angle at ($x, $y)`, 4 | results => { 5 | room.subscriptionPrefix(1); 6 | if (!!results) { 7 | results.forEach(({ width, height, angle, x, y }) => { 8 | let ill = room.newIllumination() 9 | let degreeAngle = Math.floor(angle * 180.0 / Math.PI); 10 | const fontSize = 400; 11 | ill.fontcolor(255, 255, 255) 12 | ill.fontsize(fontSize) 13 | ill.text(100, 720/2 - fontSize*0.5, `${degreeAngle}°`) 14 | room.draw(ill) 15 | room.assert(`angle is ${degreeAngle}`) 16 | }); 17 | } 18 | room.subscriptionPostfix(); 19 | }) 20 | 21 | 22 | run(); 23 | -------------------------------------------------------------------------------- /src/programs/logs/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhaip/programmable-space/9b641eb60016cf5938be66be9617dfa8da478e40/src/programs/logs/.keep -------------------------------------------------------------------------------- /util/anybeamrpicam.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Exec=/home/pi/programmable-space/jig anybeampicam2 4 | # Copy this file to ~/.config/autostart/anybeampicam.desktop 5 | -------------------------------------------------------------------------------- /util/ble-rfid.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Keep BLE Proxy Service Running on Disconnects 3 | After=network.target 4 | 5 | [Service] 6 | Type=simple 7 | User=root 8 | # Copy this file to /etc/systemd/system 9 | # sudo systemctl daemon-reload 10 | # sudo systemctl start ble-rfid 11 | # When run on a different computer you'll need to change "/home/jacob" to your computer's path 12 | Environment=PATH=/home/jacob/bin:/home/jacob/.local/bin:/home/jacob/.nvm/versions/node/v10.6.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/$ 13 | Restart=always 14 | ExecStart=/home/jacob/.nvm/versions/node/v10.6.0/bin/node /home/jacob/programmable-space/src/programs/1850__bleProxyRfid.js 15 | ExecStop=/usr/bin/pkill -f programs/1850__bleProxyRfid.js 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | -------------------------------------------------------------------------------- /util/deepspeech.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Deepspeech Proxy Service 3 | After=network.target 4 | 5 | [Service] 6 | Type=simple 7 | User=root 8 | # Copy this file to /etc/systemd/system 9 | # sudo systemctl daemon-reload 10 | # sudo systemctl start deepspeech 11 | # Run at boot: sudo systemctl enable deepspeech 12 | Environment=PATH=/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin:/home/pi/.local/bin 13 | Environment=PROG_SPACE_SERVER_URL='192.168.1.34' 14 | Restart=always 15 | ExecStart=/usr/bin/python3 /home/pi/programmable-space/src/programs/792__deepspeech.py -m /home/pi/deepspeech-0.7.4-models.tflite -s /home/pi/deepspeech-0.7.4-models.scorer 16 | ExecStop=/usr/bin/pkill -f programs/792__deepspeech.py 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /util/einkdisplay.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Eink screen Proxy Service 3 | After=network.target 4 | 5 | [Service] 6 | Type=simple 7 | WorkingDirectory=/home/pi/ 8 | User=pi 9 | # Copy this file to /etc/systemd/system 10 | # sudo systemctl daemon-reload 11 | # sudo systemctl start einkdisplay 12 | # Run at boot: sudo systemctl enable einkdisplay 13 | Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games 14 | Environment=PROG_SPACE_SERVER_URL='192.168.1.34' 15 | Restart=always 16 | ExecStart=/usr/bin/python3 /home/pi/programmable-space/src/programs/1995__einkGraphics.py 17 | ExecStop=/usr/bin/pkill -f programs/1995__einkGraphics.py 18 | 19 | [Install] 20 | WantedBy=multi-user.target 21 | -------------------------------------------------------------------------------- /util/lamp.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Exec=/home/pi/programmable-space/jig camerastart3 4 | # Exec=/home/pi/programmable-space/jig camerastart 5 | # Exec=/home/pi/programmable-space/jig lampstart2 6 | # Copy this file to ~/.config/autostart/lamp.desktop 7 | -------------------------------------------------------------------------------- /util/lightcrafter.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Exec=/home/pi/programmable-space/jig lightcrafter 4 | # Copy this file to ~/.config/autostart/lightcrafter.desktop 5 | -------------------------------------------------------------------------------- /util/lightcrafter.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Toggle Lightcrafter Project Display 3 | After=network.target 4 | 5 | [Service] 6 | Type=simple 7 | User=root 8 | # Copy this file to /etc/systemd/system 9 | # sudo systemctl daemon-reload 10 | # sudo systemctl start lightcrafter 11 | # Run at boot: sudo systemctl enable lightcrafter 12 | Environment=PATH=/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 13 | Environment=PROG_SPACE_SERVER_URL='192.168.1.34' 14 | Restart=always 15 | ExecStart=/usr/bin/python3 /home/pi/programmable-space/src/programs/1650__toggleLightcrafter.py 16 | ExecStop=/usr/bin/pkill -f programs/1650__toggleLightcrafter.py 17 | 18 | [Install] 19 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /util/ngrok/rfideditorstart2.conf: -------------------------------------------------------------------------------- 1 | authtoken: INSERT_YOUR_NGROK_AUTH_TOKEN_HERE 2 | tunnels: 3 | masterlist: 4 | addr: 3013 5 | proto: http 6 | subdomain: progspacemasterlist 7 | web2: 8 | addr: 3014 9 | proto: http 10 | subdomain: progspaceweb2 11 | -------------------------------------------------------------------------------- /util/pidisplay.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Exec=/home/pi/programmable-space/jig pieditorstart 4 | # Copy this file to ~/.config/autostart/pidisplay.desktop 5 | -------------------------------------------------------------------------------- /util/pidisplay.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Programmable Space Raspberry Pi 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | User=root 8 | # Copy this file to /etc/systemd/system 9 | # sudo systemctl daemon-reload 10 | # sudo systemctl start pidisplay 11 | # Run at boot: sudo systemctl enable pidisplay 12 | Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games 13 | RemainAfterExit=yes 14 | ExecStart=/home/pi/programmable-space/jig pieditorstart 15 | ExecStop=/home/pi/programmable-space/jig stop 16 | 17 | [Install] 18 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /util/progspace.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Programmable Space Server 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | User=jacob 8 | # Copy this file to /etc/systemd/system 9 | # sudo systemctl daemon-reload 10 | # sudo systemctl start progspace 11 | # Run at boot: sudo systemctl enable progspace 12 | # When run on a different computer you'll need to change "/home/jacob" to your computer's path 13 | Environment=GOPATH=/home/jacob/go 14 | Environment=GOBIN=/home/jacob/go/bin 15 | Environment=PATH=/home/jacob/bin:/home/jacob/.local/bin:/home/jacob/.nvm/versions/node/v10.6.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/$ 16 | Environment=DYNAMIC_ROOT=/home/jacob/programmable-space/ 17 | RemainAfterExit=yes 18 | ExecStart=/home/jacob/programmable-space/jig rfideditorstart3 19 | ExecStop=/usr/bin/sudo /home/jacob/programmable-space/jig stop 20 | 21 | [Install] 22 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /util/remoteprogspace.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Unified remote start script for programmable space clients 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | User=pi 8 | # Copy this file to /etc/systemd/system 9 | # sudo systemctl daemon-reload 10 | # sudo systemctl start remoteprogspace 11 | # Run at boot: sudo systemctl enable remoteprogspace 12 | # Environment=PATH=/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin:/home/pi/.local/bin 13 | Environment=PROG_SPACE_SERVER_URL='192.168.1.34' 14 | RemainAfterExit=yes 15 | ExecStart=/home/pi/programmable-space/jig remotestart 9005 16 | ExecStop=/usr/bin/pkill -f programs/1901__remoteProcessManager.js 17 | 18 | [Install] 19 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /util/remotestart.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Exec=/home/pi/programmable-space/jig remotestart 9003 4 | # Copy this file to ~/.config/autostart/remotestart.desktop -------------------------------------------------------------------------------- /util/text-to-speech.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Text To Speech Proxy Service 3 | After=network.target 4 | 5 | [Service] 6 | Type=simple 7 | User=root 8 | # Copy this file to /etc/systemd/system 9 | # sudo systemctl daemon-reload 10 | # sudo systemctl start text-to-speech 11 | # Run at boot: sudo systemctl enable text-to-speech 12 | Environment=PATH=/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin:/home/pi/.local/bin 13 | Environment=PROG_SPACE_SERVER_URL='192.168.1.34' 14 | Restart=always 15 | ExecStart=/usr/bin/node /home/pi/programmable-space/src/programs/793__textToSpeech.js 16 | ExecStop=/usr/bin/pkill -f programs/793__textToSpeech.js 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /util/thermal-printer.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Keep Thermal Printer Proxy Service 3 | After=network.target 4 | 5 | [Service] 6 | Type=simple 7 | User=root 8 | # Copy this file to /etc/systemd/system 9 | # sudo systemctl daemon-reload 10 | # sudo systemctl start thermal-printer 11 | # Run at boot: sudo systemctl enable thermal-printer 12 | Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games 13 | Restart=always 14 | ExecStart=/usr/bin/python3 /home/pi/programmable-space/src/programs/790__thermalPrinter.py 15 | ExecStop=/usr/bin/pkill -f programs/790__thermalPrinter.py 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | --------------------------------------------------------------------------------