Learning coding means GreatToCode Be more than a Coder ! Greattocode , Join GreatToCode Community,1000+ Students Trusted On Us .If You want to learn coding, Then GreatToCode Help You.No matter what It Takes !


CODE YOUR WAY TO A MORE FULFILLING And HIGHER PAYING CAREER IN TECH, START CODING FOR FREE Camp With GreatToCode - Join the Thousands learning to code with GreatToCode
Interactive online coding classes for at-home learning with GreatToCode . Try ₹Free Per Month Coding Classes With The Top Teachers . Study of Raspberry Pi Feedback From Switch

Study of Raspberry Pi Feedback From Switch

Become More Then A coder | Learn & Start Coding Now.
AIM: Programming of Raspberry Pi to take feedback from the switch
APPARATUS: Raspberry Pi with Raspbian Pi OS, LEDs, Resistors, Push button switch, USB Keyboard, mouse LCD Monitor, HDMI to VGA converter, 5V Power Adapter.
CIRCUIT DIAGRAM:
Procedure:
1. The kit consists of Raspberry Pi 3B+, Power adapter, HDMI to VGA converter cable and PCB with LEDs connected and the 9 pin connector.
2. One two pin and other five pin male connectors are available on the PCB.
3. The two pin connector is of 3.3V and other five pin connector consists of male connector in the sequence of Ground, LED1, LED 2, SW1 and SW2.
4. Two LEDs and Two switches are available. You can use one pair of LED and a switch ot both LEDs and two switches.
5. Connect the circuit as shown in the circuit above. Use Female to Female connecting wires to connect Raspberry Pi pins to the Led pins and switch, available on the PCB.
6. Run the program using “run” button in the IDE, it will ask you to save the file. If not saved before, save it with file name extension .py
7. Now press the switch (SW1), you will observe LED is glowing. After releasing the switch, the LED turns off. Press second switch (SW2), you will observe other LED is glowing and turns off after releasing the SW2.
Program 1:
# PROGRAM TO TAKE FEEDBACK FROM THE SWITCH
import RPi.GPIO as GPIO # Import GPIO Library
import time # Import Time Library
GPIO.setmode(GPIO.BOARD) # Set the pins as the pin numbers
GPIO.setup(8,GPIO.IN) # Set pin 8 as input
GPIO.setup(10,GPIO.OUT) # Set pin 10 as output
GPIO.output(10, False) #Turn LED OFF
while(True):
 x = GPIO.input (8) # Name the pin 8 as “x”
#single pressed
 If (x==0): # Check logically if the key is pushed
  GPIO.output (10, True) # Make output pin 10 HIGH, Turn ON LED
  print ("Switch Pressed") #Print Switch is pressed
 else:
  GPIO.output (10, False) # Make output pin 10 LOW, Turn OFF LED
  print ("Switch Released") #Print Switch is released

Post a Comment

0 Comments

•Give The opportunity to your child with GreatToCode Kid's • Online Coding Classes for Your Kid • Introduce Your kid To the world's of coding
•Fuel You Career with our 100+ Hiring Partners, Advance Your Career in Tech with GreatToCode. •Join The Largest Tech and coding Community and Fast Forward Your career with GreatToCode. •10000+ Learner's+ 90 % placement Guarantee. • Learning Coding is Better with the GreatToCode community .
•Greattocode Kid's •GreatToCode Career •GreatToCode Interview •GreatToCode Professional •GreatToCode for schools •GreatToCode For colleges •GreatToCods For Businesses.
Are you ready to join the millions of people learning to code? GreatToCode Pass is your one-stop-shop to get access to 1000+ courses, top-notch support, and successful job placement. What are you waiting for? Sign up now and get your future in motion with GreatToCode Pass.