rongyu lou / Mbed OS CarPakingSystem_V13

Dependencies:   HCSR04new SSH1106-alan

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2019 ARM Limited
00003  * SPDX-License-Identifier: Apache-2.0
00004  */
00005 
00006 #include "mbed.h"
00007 #include "platform/mbed_thread.h"
00008 #include "HCSR04.h"
00009 #include "Thread_Handle.h"
00010 #include "main.h"
00011 #include "handleTasks.h"
00012 #include "rtc.h"
00013 #include "SSH1106.h"
00014 
00015 // Blinking rate in milliseconds
00016 #define BLINKING_RATE_MS          1000
00017 
00018 
00019 
00020 //Serial pc(USBTX, USBRX); //uart init
00021 DigitalOut led(LED1);    //LED init
00022 Thread init_start_thread;
00023 AnalogIn analog_value(A0);//adc
00024 //Ticker time_ticker;
00025 
00026 
00027 int main()
00028 {   
00029     //init  start threads  
00030     //oled_Init()
00031     float meas;
00032     init_start_thread.start(init_thread);
00033 
00034     while (true) 
00035     {                   
00036         //led = !led;   
00037         meas = analog_value.read();
00038         meas = meas * 3300;
00039         printf("meas = %.0f mV \n",meas);
00040         thread_sleep_for(BLINKING_RATE_MS);
00041     }
00042 }