top of page

Plot Brightness from an LDR on Port B1

This program plots the brightness readings from an Light Dependent Resistor (LDR) connected to port B1 of the JackBord.

The circuit is the LDR, one wire conennected to the 3V power on port B and the other one is attached to port B1. A 100K resistor goes from B1 to ground.

Program


---

Plot Brightness from an LDR on Port B1

---


prog_vars =

d/brightness 0

prog_vars.


prog_start =

print "Plot Light Level from LDR on Port B1"

gvr b1 0 100

/brightness 0

prog_start.


prog_loop =


-- Scale the LDR brightness from 0 to 100 to 0 to 50

-- so it fits in the plot.

mapi 0 100 0 50 /b1 -> /brightness

-- Plot the LDR Brightness

-- Put a max line at 50

tbar B /brightness 50 20 "/b1 = /brightness"

d250

prog_loop.


prog_stop =

print "Good bye"

prog_stop.



bottom of page