Close

Swap logic levels for circuit with pullup.

A project log for Web Smart (Phone) Screen Blink Bot

Secure web page on smartphone safely drives cheap bot with flashes of light using internal sensors and web services.

james-newtonJames Newton 09/08/2022 at 18:480 Comments

Assuming the use of a photo sensitive resistor between the analog pin and ground, and an internal or external pullup resistor to the power rail, a white screen will cause a low voltage, and a black screen will allow the voltage to rise. So, to make this the default (as it's the simplest circuit possible, consisting of only the sensors plugged into the Arduino header) I've swapped the black and white blocks on the test web page, but I also made it easy to switch back with a couple of "defines" at the start:

  var logic1 = black
  var logic0 = white

https://github.com/JamesNewton/JamesNewton.github.io/commit/f36116a8cec1beee6d23ae3cc618ed002eca941c

Next steps (please help if you can?): Update the Arduino code below to decode the I2C start, data, stop and check for reliability of communications. The time required for the serial output to dump all the data into the plotter far exceeds the timing of the actual binks, so it's good to set the analog levels, turn that print off, and only output the digital signal and decoding. 

Discussions