User Tools

Site Tools


haas:fall2021:common:projects:led0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
haas:fall2021:common:projects:led0 [2020/09/18 13:28] – external edit 127.0.0.1haas:fall2021:common:projects:led0 [2021/08/27 21:00] (current) wedge
Line 20: Line 20:
 =====Background===== =====Background=====
 For this project, you will be writing a C program using the wiringPi library on the Raspberry Pi, wiring up a red LED to your breadboard and witnessing your ability to control it via software. For this project, you will be writing a C program using the wiringPi library on the Raspberry Pi, wiring up a red LED to your breadboard and witnessing your ability to control it via software.
 +
 +=====Grabbing project resources (on lab46)=====
 +I have prepared a **grabit** for resources related to this project. To obtain:
 +
 +<cli>
 +lab46:~/src/SEMESTER/desig$ grabit desig led0
 +make: Entering directory '/var/public/SEMESTER/desig/lob0'
 +'/var/public/SEMESTER/desig/led0/Makefile' -> '/home/user/src/SEMESTER/desig/led0/Makefile'
 +'/var/public/SEMESTER/desig/led0/led0.c' -> '/home/user/src/SEMESTER/desig/led0/led0.c'
 +make: Leaving directory '/var/public/SEMESTER/desig/led0'
 +lab46:~/src/SEMESTER/desig$ 
 +</cli>
 +
 +At which point you can change into the newly created and populated **led0** directory.
 +
 +=====Getting project resources from lab46 to your pi=====
 +Okay, you've snagged the project files on lab46. Now, how to get them to your pi?
 +
 +The same way you've been juggling project files already, by using your mercurial repository!
 +
 +Using the **hg** tool, be sure to **add**, **commit**, and **push** successfully on lab46.
 +
 +Then, over on your pi, use **hg** to **pull** and **update** the new changes into place. Then you can proceed.
 +
 +=====On your pi=====
 +Study and run this program on your pi in conjunction with testing and verifying operation of your properly hooked up electronics circuit. When done, submit it on lab46.
 +
 +To utilize the needed functionality for this project, you will need to ensure you have the following packages installed:
 +
 +  * **build-essential** (hopefully you took care of this in ntr0)
 +  * **wiringpi**
 +
 +====Installing wiringpi====
 +An exception to the usual package installation process, especially for those with a Raspberry Pi model 4B: when you install **wiringpi** the usual way, we may end up with errors when proceeding further, such as the following:
 +
 +<cli>
 +yourpi:~/src/SEMESTER/desig/led0$ gpio readall
 +Oops - unable to determine board type... model: 17
 +</cli>
 +
 +What you will need to do is manually install an updated (and out of database) version of the **wiringpi** package, as follows (looking out for errors along the way):
 +
 +<cli>
 +yourpi:~/src/SEMESTER/desig/led0$ wget https://project-downloads.drogon.net/wiringpi-latest.deb
 +...
 +yourpi:~/src/SEMESTER/desig/led0$ sudo dpkg -i wiringpi-latest.deb
 +...
 +yourpi:~/src/SEMESTER/desig/led0$ rm -f wiringpi-latest.deb
 +</cli>
  
 =====Input and Output via the GPIO pins on the pi===== =====Input and Output via the GPIO pins on the pi=====
Line 33: Line 82:
  
 <cli> <cli>
-yourpi:~/src/desig/led0$ gpio readall+yourpi:~/src/SEMESTER/desig/led0$ gpio readall
  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
Line 60: Line 109:
  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
-yourpi:~/src/desig/led0$ +yourpi:~/src/SEMESTER/desig/led0$ 
 </cli> </cli>
  
Line 118: Line 167:
  
 <WRAP info>The plastic rectangle should have a notch cut out from it, and notice that the ribbon cable connector has a notch included in it. That is a key to indicate how you need to connect the ribbon cable into the T-cobbler</WRAP> <WRAP info>The plastic rectangle should have a notch cut out from it, and notice that the ribbon cable connector has a notch included in it. That is a key to indicate how you need to connect the ribbon cable into the T-cobbler</WRAP>
 +
 ====(1) red LED==== ====(1) red LED====
 You have a few LEDs included in your kit, some of notably different colours. Go for one of the distinctly red looking ones, resembling the following: You have a few LEDs included in your kit, some of notably different colours. Go for one of the distinctly red looking ones, resembling the following:
Line 168: Line 218:
  
 <cli> <cli>
-yourpi:~/src/desig/led0$ gpio mode 0 OUT+yourpi:~/src/SEMESTER/desig/led0$ gpio mode 0 OUT
 </cli> </cli>
  
Line 184: Line 234:
  
 <cli> <cli>
-yourpi:~/src/desig/led0$ gpio write 0 1      ## activate voltage on wiringpi pin 0 (turn on) +yourpi:~/src/SEMESTER/desig/led0$ gpio write 0 1      ## activate voltage on wiringpi pin 0 (turn on) 
-yourpi:~/src/desig/led0$ gpio write 0 0      ## deactivate voltage on wiringpi pin 0 (turn off)+yourpi:~/src/SEMESTER/desig/led0$ gpio write 0 0      ## deactivate voltage on wiringpi pin 0 (turn off)
 </cli> </cli>
  
Line 198: Line 248:
  
 In future projects you will start implementing more logic to attain further functionality. In future projects you will start implementing more logic to attain further functionality.
- 
-====Grabbing project resources (on lab46)==== 
-I have prepared a **grabit** for resources related to this project. To obtain: 
- 
-<cli> 
-lab46:~/src/desig$ grabit desig led0 
-make: Entering directory '/var/public/SEMESTER/desig/lob0' 
-'/var/public/SEMESTER/desig/led0/Makefile' -> '/home/user/src/desig/led0/Makefile' 
-'/var/public/SEMESTER/desig/led0/led0.c' -> '/home/user/src/desig/led0/led0.c' 
-make: Leaving directory '/var/public/SEMESTER/desig/led0' 
-lab46:~/src/desig$  
-</cli> 
- 
-At which point you can change into the newly created and populated **led0** directory. 
- 
-====Getting project resources from lab46 to your pi==== 
-Okay, you've snagged the project files on lab46. Now, how to get them to your pi? 
- 
-The same way you've been juggling project files already, by using your mercurial repository! 
- 
-Using the **hg** tool, be sure to **add**, **commit**, and **push** successfully on lab46. 
- 
-Then, over on your pi, use **hg** to **pull** and **update** the new changes into place. Then you can proceed. 
- 
-====On your pi==== 
-Study and run this program on your pi in conjunction with testing and verifying operation of your properly hooked up electronics circuit. When done, submit it on lab46. 
- 
-To utilize the needed functionality for this project, you will need to ensure you have the following packages installed: 
- 
-  * **build-essential** (hopefully you took care of this in ntr0) 
-  * **wiringpi** 
- 
-===Installing wiringpi=== 
-An exception to the usual package installation process, especially for those with a Raspberry Pi model 4B: when you install **wiringpi** the usual way, we may end up with errors when proceeding further, such as the following: 
- 
-<cli> 
-yourpi:~/src/desig/led0$ gpio readall 
-Oops - unable to determine board type... model: 17 
-</cli> 
- 
-What you will need to do is manually install an updated (and out of database) version of the **wiringpi** package, as follows (looking out for errors along the way): 
- 
-<cli> 
-yourpi:~/src/desig/led0$ wget https://project-downloads.drogon.net/wiringpi-latest.deb 
-... 
-yourpi:~/src/desig/led0$ sudo dpkg -i wiringpi-latest.deb 
-... 
-yourpi:~/src/desig/led0$ rm -f wiringpi-latest.deb 
-</cli> 
  
 =====Compiling===== =====Compiling=====
Line 275: Line 276:
  
 <cli> <cli>
-lab46:~/src/desig/led0$ submit desig led0 led0.c +lab46:~/src/SEMESTER/desig/led0$ make submit
-Submitting desig project "led0": +
-    -> led0.c(OK) +
- +
-SUCCESSFULLY SUBMITTED+
 </cli> </cli>
  
haas/fall2021/common/projects/led0.1600435692.txt.gz · Last modified: 2020/09/18 13:28 by 127.0.0.1