7 seg i2c lcd

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
carlswanson60
 
Posts: 60
Joined: Tue Nov 26, 2013 1:28 pm

7 seg i2c lcd

Post by carlswanson60 »

How and where do I code the brightness for this lcd? I found some examples but can't get it to work.

User avatar
adafruit_support_bill
 
Posts: 88142
Joined: Sat Feb 07, 2009 10:11 am

Re: 7 seg i2c lcd

Post by adafruit_support_bill »

Can you post a link to the specific display you are asking about?

User avatar
carlswanson60
 
Posts: 60
Joined: Tue Nov 26, 2013 1:28 pm

Re: 7 seg i2c lcd

Post by carlswanson60 »

I am trying to use your project for displaying temp and time, I don't want to use a switch and would like the script to just automatically display temp delay and then time.
Please be kind to me and show me how to do it within the script.
Large 7 seg lcd Pi-based Thermometer and Time
This project combines a whole heap of modules to enable a Raspberry Pi to power a large 1.2 inch 4 digit 7 segment display. A small switch switches the display between showing the temperature and the current time
Your help would be appreciated.
Thanks, Carl Swanson

User avatar
adafruit_support_bill
 
Posts: 88142
Joined: Sat Feb 07, 2009 10:11 am

Re: 7 seg i2c lcd

Post by adafruit_support_bill »

To alternate between time and temperature, change the main part of the program loop to:

Code: Select all

while True:
        segment.clear()
        display_temp()
        segment.write_display()
        time.sleep(1.0)
        segment.clear()
        display_time()
        segment.write_display()
        time.sleep(1.0)

User avatar
carlswanson60
 
Posts: 60
Joined: Tue Nov 26, 2013 1:28 pm

Re: 7 seg i2c lcd

Post by carlswanson60 »

Thank you very much!

User avatar
carlswanson60
 
Posts: 60
Joined: Tue Nov 26, 2013 1:28 pm

Re: 7 seg i2c lcd

Post by carlswanson60 »

Got that figured out, now new problem, timestamp within PIR program is not incrementing, prints the same number each time.

Code: Select all

#!/usr/bin/python

import time
import RPi.GPIO as GPIO
import os
import datetime
from datetime import datetime, timedelta
t = datetime.now() + timedelta(seconds=3000)
print(t)

GPIO.setmode(GPIO.BCM)

GPIO.setmode(GPIO.BCM)
#GPIO.setwarnings(False)

led1 = 21

pirPin = 17

GPIO.setup(led1,GPIO.OUT)
GPIO.setup(pirPin, GPIO.IN)


print t


def LIGHTS(pirPin):

    """Turns LEDS On and Off"""
    print(t)
	
    print("Lights on")
    GPIO.output(led1,GPIO.HIGH)
   

    time.sleep(7)

    print("Light off")
    GPIO.output(led1,GPIO.LOW)
    

print("Motion Sensor Alarm (CTRL+C to exit)")
time.sleep(.2)
print("Ready")
print t

try:
    GPIO.add_event_detect(pirPin, GPIO.RISING, callback=LIGHTS)
    while 1:
    
        time.sleep(1)
except KeyboardInterrupt:
    print("Quit")
    GPIO.cleanup()
Last edited by adafruit_support_bill on Tue Jun 18, 2019 4:12 pm, edited 1 time in total.
Reason: please use [code] tags when posting code to the forums

User avatar
carlswanson60
 
Posts: 60
Joined: Tue Nov 26, 2013 1:28 pm

Re: 7 seg i2c lcd

Post by carlswanson60 »

Got that figured out, now new problem, timestamp within PIR program is not incrementing, prints the same number each time.
#!/usr/bin/python

import time
import RPi.GPIO as GPIO
import os
import datetime
from datetime import datetime, timedelta
t = datetime.now() + timedelta(seconds=3000)
print(t)

GPIO.setmode(GPIO.BCM)

GPIO.setmode(GPIO.BCM)
#GPIO.setwarnings(False)

led1 = 21

pirPin = 17

GPIO.setup(led1,GPIO.OUT)
GPIO.setup(pirPin, GPIO.IN)


print t


def LIGHTS(pirPin):

"""Turns LEDS On and Off"""
print(t)

print("Lights on")
GPIO.output(led1,GPIO.HIGH)


time.sleep(7)

print("Light off")
GPIO.output(led1,GPIO.LOW)


print("Motion Sensor Alarm (CTRL+C to exit)")
time.sleep(.2)
print("Ready")
print t

try:
GPIO.add_event_detect(pirPin, GPIO.RISING, callback=LIGHTS)
while 1:

time.sleep(1)
except KeyboardInterrupt:
print("Quit")
GPIO.cleanup()

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”