NeoSteamLabs
Published © CC BY

Project #30 - UNIHIKER - Ambient Light Sensor - Mk02

UNIHIKER Ambient Light Sensor

BeginnerFull instructions provided30 minutes53
Project #30 - UNIHIKER - Ambient Light Sensor - Mk02

Things used in this project

Hardware components

UNIHIKER M10 - IoT Python Programming Single Board Computer with Touchscreen
DFRobot UNIHIKER M10 - IoT Python Programming Single Board Computer with Touchscreen
×1
SparkFun USB Battery Pack
×1
DFRobot USB 3.1 Cable A to C
×1

Software apps and online services

Python

Story

Read more

Schematics

Fritzing

Code

DL2408Mk05p.py

Python
"""
****** Don Luc Electronics © ******
Software Version Information
Project #30 - UNIHIKER - Ambient Light Sensor - Mk02
30-02
DL2408Mk05.py
DL2408Mk05
1 x UNIHIKER
1 x USB Battery Pack
1 x USB 3.1 Cable A to C

-*- coding: utf-8 -*-
"""
# Import the unihiker library
from unihiker import GUI

# Import the time library
import time

# Import the Board module from the pinpong.board package 
from pinpong.board import Board

# Import all modules from the pinpong.extension.unihiker package
from pinpong.extension.unihiker import *

# Initialize the board by selecting the board type and port number;
# if not specified, the program will automatically detect it
Board().begin()

# Instantiate the GUI class and create a gui object
gui = GUI()

# Display the initial background image 'dlemk02'
img = gui.draw_image(x=0, y=0, w=240, h=320, image='DL2408Mk05p.png')

# Ambient Light Sensor
# Display the initial Ambient Light Sensor valueLight
valueLight = gui.draw_text(x=30, y=151, text='0', font_size=18)

while True:
    
    # Ambient Light Sensor
    # Read the light value
    AmbientLightSensor = light.read()
    # Update the displayed light value
    valueLight.config(text=AmbientLightSensor)

    # Delay for 1 second to keep the screen content displayed for a longer time
    time.sleep(1)

Credits

NeoSteamLabs
40 projects • 15 followers
Luc Paquin Microcontrollers, IoT, Robotics Experts https://www.donluc.com https://www.donluc.com/luc https://www.linkedin.com/in/jlucpaquin

Comments