Initial version

Dependencies:   C12832_mod LM75B MMA7660 mbed-src

Fork of GR-PEACH_blinky by Toyomasa Watarai

Committer:
MACRUM
Date:
Thu Nov 27 06:34:31 2014 +0000
Revision:
3:ff37d121c2e7
Parent:
1:46d9c55342aa
Initial release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:b2580afd6abb 1 #include "mbed.h"
MACRUM 1:46d9c55342aa 2 #include "C12832.h"
MACRUM 1:46d9c55342aa 3 #include "LM75B.h"
MACRUM 1:46d9c55342aa 4 #include "MMA7660.h"
MACRUM 1:46d9c55342aa 5
MACRUM 1:46d9c55342aa 6 C12832 lcd(D11, D13, D12, D7, D10);
MACRUM 1:46d9c55342aa 7 AnalogIn pot1(A0);
MACRUM 1:46d9c55342aa 8 AnalogIn pot2(A1);
MACRUM 1:46d9c55342aa 9 LM75B sensor(I2C_SDA, I2C_SCL);
MACRUM 1:46d9c55342aa 10 //MMA7660 acc(I2C_SDA, I2C_SCL);
MACRUM 0:b2580afd6abb 11
MACRUM 1:46d9c55342aa 12 DigitalOut led_tcik(LED_BLUE);
MACRUM 1:46d9c55342aa 13 DigitalOut myled(D8);
MACRUM 1:46d9c55342aa 14 PwmOut pwm_led(D9);
MACRUM 1:46d9c55342aa 15 PwmOut usr_led(LED_USER);
MACRUM 1:46d9c55342aa 16
MACRUM 1:46d9c55342aa 17 Ticker ficker;
MACRUM 1:46d9c55342aa 18
MACRUM 1:46d9c55342aa 19 void flip() {
MACRUM 1:46d9c55342aa 20 led_tcik = !led_tcik;
MACRUM 1:46d9c55342aa 21 }
MACRUM 0:b2580afd6abb 22
MACRUM 0:b2580afd6abb 23 int main() {
MACRUM 1:46d9c55342aa 24 int cnt = 0;
MACRUM 1:46d9c55342aa 25 myled = 1;
MACRUM 1:46d9c55342aa 26 ficker.attach(&flip, 1);
MACRUM 1:46d9c55342aa 27
MACRUM 1:46d9c55342aa 28 lcd.cls();
MACRUM 1:46d9c55342aa 29 lcd.locate(0, 0);
MACRUM 1:46d9c55342aa 30 lcd.printf("GR-PEACH & App shield!");
MACRUM 1:46d9c55342aa 31 //printf("GR-PEACH + mbed app shield!\n");
MACRUM 1:46d9c55342aa 32
MACRUM 0:b2580afd6abb 33 while(1) {
MACRUM 1:46d9c55342aa 34 lcd.locate(0,15);
MACRUM 1:46d9c55342aa 35 lcd.printf("Counting: %d", cnt);
MACRUM 1:46d9c55342aa 36
MACRUM 1:46d9c55342aa 37 lcd.locate(70,15);
MACRUM 1:46d9c55342aa 38 lcd.printf("p1=%f", pot1.read());
MACRUM 1:46d9c55342aa 39 lcd.locate(70,15+8);
MACRUM 1:46d9c55342aa 40 lcd.printf("p2=%f", pot2.read());
MACRUM 1:46d9c55342aa 41 lcd.locate(20,15+8);
MACRUM 1:46d9c55342aa 42 lcd.printf("%8.3f", sensor.read());
MACRUM 1:46d9c55342aa 43 pwm_led = pot1.read();
MACRUM 1:46d9c55342aa 44 usr_led = 1.0f - pot2.read();
MACRUM 1:46d9c55342aa 45
MACRUM 1:46d9c55342aa 46 //lcd.locate(0,8);
MACRUM 1:46d9c55342aa 47 //lcd.printf("%6.2f, %6.2f, %6.2f\n", acc.x(), acc.y(), acc.z());
MACRUM 1:46d9c55342aa 48
MACRUM 1:46d9c55342aa 49 myled = !myled;
MACRUM 1:46d9c55342aa 50 cnt++;
MACRUM 1:46d9c55342aa 51 wait(0.5);
MACRUM 0:b2580afd6abb 52 }
MACRUM 0:b2580afd6abb 53 }