You are viewing an older revision! See the latest version
Project Overview
Overview¶
The aim of this project is to create a working clock using FRDM-KL25Z and necessary components while also exploring the use of distance sensors as input (control pannel) and possible game ideas with the use multiple screens.
Clock¶
Distance Sensors¶
Setup¶
We're using tobeaddedlater as the distance sensor. Using this MaxSonar library, one can quickly get the sensor up and running. The library contains the MaxSonar class with an example of the setup:
<<code title=MaxSonar Example>>
- include "mbed.h"
- include "MaxSonar.h "
int main() { MaxSonar *range; float r;
Create and configure object for 3.3V powered LV-series device, accessed with analog reads (in cm) on p16, triggered by p7. range = new MaxSonar(MS_LV, MS_ANALOG, p7, p16); range->setVoltage(3.3); range->setUnits(MS_CM);
while(1) { Trigger read, wait 49ms until ranger finder has finished, then read. range->triggerRead(); wait_ms(49); r = range->read();
Print and delay 0.5s. printf("Range: %.3f cm\n", r); wait(0.5); } } <</code>>