Mobile Security System - Revision 1.0
Dependencies: FXOS8700Q N5110 SDFileSystem SRF02 mbed
main.cpp
- Committer:
- el14dg
- Date:
- 2016-03-04
- Revision:
- 1:3ae4192d0c25
- Parent:
- 0:12ae42019e9f
- Child:
- 2:e504a3cfe113
File content as of revision 1:3ae4192d0c25:
/* ELEC2645 Project Week 19 - Take distance readings from the sensor and set-up Doxygen comments Week 20 - Week 21 - Week Easter - Week 22 - Week 23 - Week 24 - */ #include "main.h" int main() { // initialise the board and serial port init_K64F(); init_serial(); while (1) { for (int i = 1; i < 11; i++) { // read sensor and accelerometer distance = srf02.getDistanceCm(); } // print over serial port pc.printf("Distance = %d cm\n",distance); // short delay before next measurement wait(0.5); } } void init_serial() { // set to highest baud - ensure terminal software matches pc.baud(115200); } void init_K64F() { // on-board LEDs are active-low, so set pin high to turn them off. r_led = 1; g_led = 1; b_led = 1; // since the on-board switches have external pull-ups, we should disable the internal pull-down // resistors that are enabled by default using InterruptIn sw2.mode(PullNone); sw3.mode(PullNone); }