beep keypad

Dependencies:   TextLCD mbed

Fork of Autus by Umair Aftab

Revision:
5:780a0888c3f2
Parent:
4:0cd0c7fe0682
--- a/main.cpp	Sun Apr 06 04:10:57 2014 +0000
+++ b/main.cpp	Sat Apr 12 20:55:13 2014 +0000
@@ -5,12 +5,15 @@
 #include "buzz.h"
 #include "TextLCD.h"
 
-#include "esc.h"
+
+//#include "esc.h"
 //1 ESC esc1(PTC9);
 PwmOut led_blue(PTC9);
-TextLCD lcd(PTE29, PTE30, PTC1, PTD0, PTD5, PTA13, TextLCD::LCD20x2); // rs, e, d4-d7 ok
-Serial pc(PTE20,PTE21);
+TextLCD lcd(PTE29, PTE30, PTC1, PTD0, PTD5, PTA13, TextLCD::LCD20x2);   // rs, e, d4-d7 ok
+Serial pc(PTE22,PTE23);
 DigitalOut r0(PTD7);
+DigitalOut fan_in_peltier(PTC11);                                       // Peltier FAN inside  the camber
+DigitalOut fan_out_peltier(PTC10);                                      // Peltier FAN outside of the chamber
 Ticker timer1ms;
 unsigned int led_blue_pulsewidth;
 /*
@@ -29,7 +32,8 @@
 
 */
 int main(void)
-{
+{wait(2);
+    pc.printf("hello");
 
     /*
 
@@ -88,9 +92,9 @@
     /*1 esc1.setThrottle(10);
             esc1.pulse();
             wait_ms(20);  // 20ms is the default period of the ESC pwm */
-    led_blue.period_us(10000);
+    led_blue.period_us(1000);
 
-    timer1ms.attach(&timer1, 0.1); //interrupt attached function(timer) with interval (1 ms)
+    timer1ms.attach(&timer1, 0.001); //interrupt attached function(timer) with interval (1 ms)
     pc.baud( BAUDRATE0 );
     char key;
     // lcd.cls();
@@ -98,16 +102,17 @@
     lcd.locate(0,0);
     lcd.printf("Hello 123456");
     wait(5.0);
-    led_blue_pulsewidth=500;
+    led_blue_pulsewidth=50;
 
     while(1) {
-        led_blue.period_us(10000);
+
+        led_blue.period_us(1000);
         //led_blue.pulsewidth_us(led_blue_pulsewidth);
         //  lcd.cls();
         key = Keypad();
         lcd.cls();
         lcd.locate(0,1);
-        lcd.printf("%c",key);
+        lcd.printf("Temp is %2.1fC\n\r", key);
        // if ((led_blue_pulsewidth >= 0 )&&( led_blue_pulsewidth <= 10000)) {
             if (key==61) {
                 led_blue_pulsewidth=led_blue_pulsewidth+100;
@@ -118,6 +123,8 @@
                 led_blue.pulsewidth_us(led_blue_pulsewidth);
             };
      //   };
+if (key==61) {fan_in_peltier=0;fan_out_peltier=1;};
+if (key==58) {fan_out_peltier=0;fan_in_peltier=1;};
 
         //if (key!=NULL)
         //{}