Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 00004 Serial xbee1(p9, p10); 00005 DigitalOut rst1(p11); 00006 Serial sndpn(p13, p14); 00007 00008 DigitalOut myled(LED1); 00009 DigitalOut myled2(LED2); 00010 DigitalIn ready(p8); 00011 DigitalIn flag( 00012 00013 TextLCD lcd(p15, p16, p17, p18, p19, p20); 00014 00015 int main() { 00016 00017 rst1 = 0; //Set reset pin to 0 00018 myled = 0; 00019 myled2= 0; 00020 wait_ms(1); 00021 rst1 = 1; //Set reset pin to 1 00022 wait_ms(1); 00023 00024 lcd.printf("Welcome\n"); 00025 wait(2); 00026 lcd.cls(); 00027 00028 //printf("hello\n"); 00029 while(1) 00030 { 00031 int id = 0; 00032 int PIN = 0; 00033 myled = 1; 00034 if (xbee1.readable()) 00035 { 00036 xbee1.scanf(" %d", &id); 00037 myled = 0; 00038 PIN = rand()%9000 + 1000; 00039 // prev = data; 00040 wait(0.01); 00041 lcd.printf(" Pin: %d", PIN); 00042 //lcd.printf(" ID:%d", id); 00043 { 00044 00045 sndpn.printf("%d %d \r", id, PIN); 00046 wait(10); 00047 } 00048 } 00049 lcd.cls(); 00050 00051 00052 } 00053 } 00054 00055 00056 // // int rnd = rand()%1000; //generates random integer between 1 and 1000 00057 //// 00058 //// 00059 //// int PIN = id*rnd; //mutliplies id and random number 00060 // lcd.printf("YOur PIN is: %d", id); //displays pin 00061 // //sndpn = PIN; //sets sndpn to pin (to send to computer for comparison) 00062 // wait(2); //shows for 20 seconds (to allow to write down -- shorter maybe) 00063 // lcd.cls(); //clears screen 00064 00065 00066 //if (flag) {led = 0;} //led to say pc in use 00067 // else {led = 1;} 00068 00069 00070 00071
Generated on Tue Jul 12 2022 21:45:20 by
1.7.2