Tim Johnson
/
Controlling_GPIO_pinouts
How to control an output pin...and how to find out what the compiler name for the pin is.
main.cpp@0:e3b48fea2164, 2015-12-20 (annotated)
- Committer:
- captaintim
- Date:
- Sun Dec 20 04:27:14 2015 +0000
- Revision:
- 0:e3b48fea2164
- Child:
- 1:0e26c8d5e834
Testing controlling an output pin and how to find out the compiler name for the output pin.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
captaintim | 0:e3b48fea2164 | 1 | #include "mbed.h" |
captaintim | 0:e3b48fea2164 | 2 | |
captaintim | 0:e3b48fea2164 | 3 | /*comments: testing turning on and off of Pin 26 |
captaintim | 0:e3b48fea2164 | 4 | using https://developer.mbed.org/users/synvox/notebook/lpc1768-pinout-with-labelled-mbed-pins/ |
captaintim | 0:e3b48fea2164 | 5 | by Nenad Milosevic as a guide to the complier name (P2_0) for pin 26 |
captaintim | 0:e3b48fea2164 | 6 | verification: put the black lead of a multimeter on pin 1 (gnd) |
captaintim | 0:e3b48fea2164 | 7 | and put the red lead on pin 26, voltage varies between +3.28VDC and 0VDC */ |
captaintim | 0:e3b48fea2164 | 8 | |
captaintim | 0:e3b48fea2164 | 9 | |
captaintim | 0:e3b48fea2164 | 10 | int main() { |
captaintim | 0:e3b48fea2164 | 11 | int on = 1; |
captaintim | 0:e3b48fea2164 | 12 | int off = 0; |
captaintim | 0:e3b48fea2164 | 13 | int i = 5; |
captaintim | 0:e3b48fea2164 | 14 | |
captaintim | 0:e3b48fea2164 | 15 | while(1){ |
captaintim | 0:e3b48fea2164 | 16 | DigitalOut (P2_0, on); //pin 26 |
captaintim | 0:e3b48fea2164 | 17 | wait (i); |
captaintim | 0:e3b48fea2164 | 18 | DigitalOut (P2_0, off); |
captaintim | 0:e3b48fea2164 | 19 | wait (i); |
captaintim | 0:e3b48fea2164 | 20 | } |
captaintim | 0:e3b48fea2164 | 21 | } |