DigitalIn program: while toggling one pin, a jumper to a 2nd pin allows you to see values on the first using Tera term.
main.cpp
00001 #include "mbed.h" 00002 00003 /*comments: while toggling Pin 26 on and off, Pin 22 sees the change using Tera Term 00004 using https://developer.mbed.org/users/synvox/notebook/lpc1768-pinout-with-labelled-mbed-pins/ 00005 by Nenad Milosevic as a guide to the complier name (P2_0) for pin 26 (p26 also works). 00006 verification: 00007 1.Insert Jumper between Pins 26 and 22 on LPC1768 00008 2.Turn on your terminal program 00009 */ 00010 00011 int on = 1; 00012 int off = 0; 00013 int i = 2.5; 00014 DigitalIn data(P2_4); 00015 00016 /* the following declaration also works 00017 *DigitalIn data(p22); 00018 * there are two different ways of addressing the pins 00019 */ 00020 00021 Serial pc(USBTX, USBRX); 00022 00023 int main() { 00024 00025 while(1){ 00026 DigitalOut (p26, on); //Pin 26 designation is p26 00027 printf("value of p22 is: %d \r\n", data.read()); 00028 wait (i); 00029 00030 DigitalOut (P2_0, off); //Pin 26 designation is P2_0 00031 printf("value of p22 is: %d \r\n", data.read()); 00032 wait (i); 00033 00034 } 00035 }
Generated on Tue Jul 19 2022 19:29:17 by 1.7.2