{"id":20319898,"url":"https://github.com/banjerr/thelovemachine","last_synced_at":"2026-05-22T16:34:02.032Z","repository":{"id":84220443,"uuid":"78354677","full_name":"Banjerr/theLoveMachine","owner":"Banjerr","description":"Arduino project that tells you how hot you are...","archived":false,"fork":false,"pushed_at":"2017-01-08T20:31:49.000Z","size":70498,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T09:32:06.183Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Banjerr.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-08T16:15:12.000Z","updated_at":"2017-01-23T00:11:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"fcc39a2f-7988-4d4d-88c5-337464f51bc1","html_url":"https://github.com/Banjerr/theLoveMachine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Banjerr/theLoveMachine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banjerr%2FtheLoveMachine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banjerr%2FtheLoveMachine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banjerr%2FtheLoveMachine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banjerr%2FtheLoveMachine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Banjerr","download_url":"https://codeload.github.com/Banjerr/theLoveMachine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banjerr%2FtheLoveMachine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33354036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T12:23:38.849Z","status":"online","status_checked_at":"2026-05-22T02:00:06.671Z","response_time":265,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T18:48:24.230Z","updated_at":"2026-05-22T16:34:02.014Z","avatar_url":"https://github.com/Banjerr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# theLoveMachine\n\n![pic!](https://github.com/Banjerr/theLoveMachine/blob/master/theLoveMachine.gif)\n\nThis is another simple project from the Arduino starter kit. Coded first with native C/C++ and then converting that over to JavaScript utilizing the Johnny-Five lib. The temperature sensor outputs the voltage/temperature back to the terminal via a simple `console.log`. The lights come on depending on how warm the sensor gets. \n\n## original Arduino (C/C++) code\n\n```c\n/**\n * THE LOVE MACHINE\n * written by Ben Redden\n */\n\nconst int sensorPin = A0;\nconst float baselineTemp = 23.4;\n\nvoid setup() {\n  Serial.begin(9600); // open a serial port at 9600 bits per second\n\n  // loop through all the pins with LEDs attached\n  for (int pinNumber = 2; pinNumber \u003c 5; pinNumber++) {\n    pinMode(pinNumber, OUTPUT); // this is an output pin\n    digitalWrite(pinNumber, LOW); // this is now off\n  }\n}\n\nvoid loop() {\n  int sensorVal = analogRead(sensorPin); // get the voltage on the pin and save to a val\n\n  // send data back to the serial monitor in the IDE\n  Serial.print(\"Sensor Value: \");\n  Serial.print(sensorVal);\n\n  // Analog to Digital Conversion (ADC) to voltage\n  // sensor reports back int in range 0 - 1024, Arduino is 5v\n  float voltage = (sensorVal/1024.0) * 5.0;\n\n  Serial.print(\", Volts: \");\n  Serial.print(voltage);\n\n  // convert the voltage to temp in degrees\n  Serial.print(\", degrees C: \");\n  float temperature = (voltage - .5) * 100;\n  Serial.println(temperature);\n\n  // light it up\n  if (temperature \u003c baselineTemp) {\n    digitalWrite(2, LOW);\n    digitalWrite(3, LOW);\n    digitalWrite(4, LOW); // these are all off\n  }\n  else if (temperature \u003e= baselineTemp+2 \u0026\u0026 temperature \u003c baselineTemp+4) {\n    digitalWrite(2, HIGH); // this is now on\n    digitalWrite(3, LOW); // still off\n    digitalWrite(4, LOW);\n  }\n  else if (temperature \u003e= baselineTemp+4 \u0026\u0026 temperature \u003c baselineTemp+6) {\n    digitalWrite(2, HIGH);\n    digitalWrite(3, HIGH); // this is now on\n    digitalWrite(4, LOW); // still off\n  }\n  else if (temperature \u003e= baselineTemp+6) {\n    digitalWrite(2, HIGH);\n    digitalWrite(3, HIGH);\n    digitalWrite(4, HIGH); // this is now on\n  }\n\n  delay(1); // ADC can only read so fast, delay at end of loop\n}\n```\n\n## Johnny-Five JavaScript (with some Underscore.js too)\n\n```javascript\n'use strict'\n\n/**\n * THE LOVE MACHINE\n * written by Ben Redden\n */\n\nconst sensorPin = 'A0',\n  baselineTemp = 20,\n  five = require('johnny-five'),\n  board = new five.Board(),\n  outputPins = [2, 3, 4],\n  _ = require('underscore');\n\nlet ledObject = {},\n  sensorVal = 0;\n\nboard.on('ready', function() {\n  // set up the sensor on analog pin 0 (sensorPin)\n  const tempSensor = new five.Sensor(sensorPin);\n\n  // set up LEDs on pins 2-4\n  _.each(outputPins, function(outputPin) {\n    board.pinMode(outputPin, five.Pin.OUTPUT); // pin is an output\n    board.digitalWrite(outputPin, 0); // they are off\n  });\n\n  setTimeout(function(){ // delay to give sensor time to catch up\n    // get data from the tempSensor\n    tempSensor.on('change', function() {\n      sensorVal = this.value;\n      // alert the console\n      console.log('Sensor Value: ' + sensorVal);\n\n      // Analog to Digital Conversion (ADC) to voltage\n      // sensor reports back int in range 0 - 1024, Arduino is 5v\n      let voltage = (sensorVal/1024.0) * 5.0;\n      // more alerts\n      console.log(', Volts: ' + voltage);\n      \n      // convert voltage to temp in degrees C\n      let temperature = (voltage - .5) * 100;\n      // alert again\n      console.log(', Temperature degrees C: ' + temperature);\n\n      // light it up\n      if (temperature \u003c baselineTemp) {\n        board.digitalWrite(2, 0);\n        board.digitalWrite(3, 0);\n        board.digitalWrite(4, 0); // these are all off\n      }\n      else if (temperature \u003e= baselineTemp + 2 \u0026\u0026 temperature \u003c baselineTemp + 4) {\n        board.digitalWrite(2, 1); // this is now on\n        board.digitalWrite(3, 0); // still off\n        board.digitalWrite(4, 0);\n      }\n      else if (temperature \u003e= baselineTemp + 4 \u0026\u0026 temperature \u003c baselineTemp + 6) {\n        board.digitalWrite(2, 1);\n        board.digitalWrite(3, 1); // this is now on\n        board.digitalWrite(4, 0); // still off\n      }\n      else if (temperature \u003e= baselineTemp + 6) {\n        board.digitalWrite(2, 1);\n        board.digitalWrite(3, 1);\n        board.digitalWrite(4, 1); // this is now on\n      }\n    });\n  }, 5000);\n});\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanjerr%2Fthelovemachine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbanjerr%2Fthelovemachine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanjerr%2Fthelovemachine/lists"}