Light
- Overview
- Drivers
- Samples
- Projects
Light Level Sensor
Key features • On-board light sensor | Resources 📄Schematics |
These Beyond the Standard Library, these functions are provided.
Function | Description | Use |
---|---|---|
Light() | Return value from 0 to 100. | |
DVer() | This driver version. |
The Code!
Modules ship with this script preloaded. Use Console to reload or modify the drivers. Additionally, some languages, such as Python, include DUELink.Engine.Record()
for recording scripts directly from the host.
##### Driver Code Starts Here ###
fn Light()
return trunc(vread(1)/(readvcc() )*100)
fend
fn DVer()
return 0.1
fend
##### User Code Starts Here #####
- Script
- Python
- JavaScript
Use Console to modify the default driver by adding this sample.
# Append this code at the bottom of the script, right after the driver.
# You MUST keep the driver code!!
While 1
println(Light())
Wait(1000)
wend
from DUELink.DUELinkController import DUELinkController
import time
availablePort = DUELinkController.GetConnectionPort()
duelink = DUELinkController(availablePort)
//code
These project samples will get you started.
- Arduino
- Standalone
This demo uses Arduino UNO R4 to read analog A0 and show value on screen.
image
Use the Standalone feature to create an analog clock.
image
The demo uses USB Hook to set the time (and load scripts.)
The Code!
Python Code
Ordering Info
Description | Part Number | Price |
---|---|---|
Light Sensor | GDL-SELIGHT-A | $00.00 |