Posts

Showing posts from August, 2018

raspberry gpio tutorial 7...ultrasonic and LCD display working in tamil

Image
that LCD coding is not available in internet. so that rare coding. so if you want download that..or copy that Coding for ultrasonic with LCD import RPi.GPIO as GPIO import time def get_distance():     GPIO.output(trig, True)     time.sleep(0.0001)     GPIO.output(trig, False)     srt = 0     fsh = 0     while GPIO.input(echo) == False:         srt = time.time()     while GPIO.input(echo) == True:         fsh = time.time()     dif = fsh - srt     dis_cm = dif/0.000058     return dis_cm # Define GPIO to LCD mapping LCD_RS = 26 LCD_E  = 19 LCD_D4 = 13 LCD_D5 = 6 LCD_D6 = 5 LCD_D7 = 11 trig = 4 echo = 18 # Define some device constants LCD_WIDTH = 16    # Maximum characters per line LCD_CHR = True LCD_CMD = False LCD_LINE_1 = 0x80 # LCD RAM address for the 1st line LCD_LINE_2 = 0xC0 # LCD RAM address for the 2nd line # Timing constants E_PULSE = 0.0005 E_DELAY = 0.0005 def main():   # Main program block

raspberry gpio tutorial 5...control LED using ultrasonic in tamil

python codings import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) led = 17 echo = 4 trig = 18 GPIO.setup(echo , GPIO.IN) GPIO.setup(led , GPIO.OUT) GPIO.setup(trig , GPIO.OUT) while 1:     GPIO.output(trig ,True)     time.sleep(0.00001)     GPIO.output(trig ,False)     while GPIO.input(echo) == False:         srt = time.time()     while GPIO.input(echo) == True:         end  = time.time()     duration = end - srt     distance_cm = duration/0.000058     print distance_cm     if distance_cm < 10:         GPIO.output(led , GPIO.HIGH)     else :         GPIO.output(led , GPIO.LOW)     time.sleep(.1) ************************************************************ copy that and upload in your python idle

raspberry gpio tutorial 4..distance measuring using ultrasonic

python codings import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) trig = 4 echo = 18 GPIO.setup(trig , GPIO.OUT) GPIO.setup(echo , GPIO.IN) while 1:     GPIO.output(trig, True)     time.sleep(0.0001)     GPIO.output(trig, False)     while GPIO.input(echo) == False:         srt = time.time()     while GPIO.input(echo) == True:         fsh = time.time()     dif = fsh - srt     #for cm :     dis_cm = dif/0.000058     dis_inch = dif/0.000148     print('distance: {}cm'.format(dis_cm))     time.sleep(.5) ********************************************************************************* copy that and paste in your python idle

raspberry gpio tutorial 2.. getting input using switch in tamil

python codings import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(17,GPIO.IN) while 1:     if GPIO.input(17):         print 'button pressed'         time.sleep(1)     else:         print 'button not pressed'         time.sleep(1)          *************************************************************************************************************** copy that and paste in your python idle

raspberry gpio tutorial 3..control LED using button in tamil

python codings      import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(17,GPIO.IN) GPIO.setup(27,GPIO.OUT) while 1:     if GPIO.input(17):         GPIO.output(27,GPIO.LOW)         print 'led off'         time.sleep(1)     else:         GPIO.output(27,GPIO.HIGH)         print 'led on'         time.sleep(1) ********************************************************************************* copy that and paste in your python idle