Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed MODSERIAL telemetry-master
Fork of coolcarsuperfast by
Diff: main.cpp
- Revision:
- 24:7fc204a3d013
- Parent:
- 23:bf38d7d2255a
- Child:
- 25:dbadea3c526d
--- a/main.cpp Tue Apr 28 22:29:41 2015 +0000 +++ b/main.cpp Tue May 05 21:31:55 2015 +0000 @@ -1,6 +1,19 @@ #include "mbed.h" +#include "telemetry.h" +#include "telemetry-mbed.h" +#include "MODSERIAL.h" + #include "stdlib.h" #include <vector> + +MODSERIAL telemetry_serial(USBTX, USBRX); +telemetry::MbedHal telemetry_hal(telemetry_serial); +telemetry::Telemetry telemetry_obj(telemetry_hal); + +telemetry::Numeric<uint32_t> tele_time_ms(telemetry_obj, "time", "Time", "ms", 0); +telemetry::NumericArray<uint16_t, 128> tele_linescan(telemetry_obj, "linescan", "Linescan", "ADC", 0); +telemetry::Numeric<float> tele_motor_pwm(telemetry_obj, "motor", "Motor PWM", "%DC", 0); + //Outputs DigitalOut led1(LED1); DigitalOut clk(PTD5); @@ -11,7 +24,7 @@ DigitalOut break2(PTC0); PwmOut servo(PTA5); -Serial pc(USBTX, USBRX); // tx, rx +//Serial pc(USBTX, USBRX); // tx, rx //Inputs AnalogIn camData(PTC2); @@ -120,6 +133,9 @@ int main() { + telemetry_serial.baud(115200); + telemetry_obj.transmit_header(); + //Alter reg values to speed up KL25Z initADC(); @@ -146,13 +162,13 @@ firstTime = true; - //t.start(); + t.start(); if(dataCol){ loopCounterForModdingSoThatWeCanIncreaseTheRecordingTime = 0; printTimer.start(); } - + //uint16_t* data = camData.read(); while(1) { if(dataCol){ //break out of main loop if enough time has passed; @@ -328,8 +344,14 @@ loopCounterForModdingSoThatWeCanIncreaseTheRecordingTime++; } //camData. + tele_time_ms = t.read_ms(); + for (uint16_t i=0; i<128; i++) { + tele_linescan[i] = ADCdata[i]; + } + telemetry_obj.do_io(); } +/* if (dataCol){ //print frame data pc.printf("printing frame data\n\r"); @@ -343,5 +365,6 @@ } pc.printf("]\n\r"); } + */ }