0% found this document useful (0 votes)
28 views1 page

Running The Code: Configuring I2C

The document provides instructions for writing and running a Python script to control an LED connected to a Raspberry Pi GPIO pin. It explains that once the code is written and checked in a text editor, it should be saved and exited. To run the script, the user types "sudo python LED.py" at the command line. It also mentions installing some additional packages for I2C communication and upgrading packages with commands like "sudo apt update".
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views1 page

Running The Code: Configuring I2C

The document provides instructions for writing and running a Python script to control an LED connected to a Raspberry Pi GPIO pin. It explains that once the code is written and checked in a text editor, it should be saved and exited. To run the script, the user types "sudo python LED.py" at the command line. It also mentions installing some additional packages for I2C communication and upgrading packages with commands like "sudo apt update".
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

nano LED.

py

import RPi.GPIO as GPIO


import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
print "LED on"
GPIO.output(18,GPIO.HIGH)
time.sleep(1)
print "LED off"
GPIO.output(18,GPIO.LOW)

--Once you have typed all the code and checked it, save and exit the text editor with “Ctrl + x” then
“y” then “enter”.---------------

Running the Code


To run this code type:

sudo python LED.py


Secure Shell (SSH),

Configuring I2C
1. sudo apt-get install -y python-smbus
2. sudo apt-get install -y i2c-tools

sudo apt update && sudo apt upgrade.

-------------------------------------
==========================================================================

STEP
Ctrl-X, Y to save the file.

========sudo nano gpio_blink.py

==============================================================--------
----------------------------------------kk=

You might also like