Biorobotics_group_2 / Mbed 2 deprecated Read_potentiometer

Dependencies:   HIDScope mbed

Files at this revision

API Documentation at this revision

Comitter:
sjoerdbarts
Date:
Thu Oct 06 12:58:35 2016 +0000
Parent:
0:1883abafaa19
Child:
2:5fce9d33997f
Commit message:
HIDScope is not working, dont know why so left out of code as of now.

Changed in this revision

HIDScope.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HIDScope.lib	Thu Oct 06 12:58:35 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/tomlankhorst/code/HIDScope/#eade4ec5282b
--- a/main.cpp	Mon Sep 26 09:56:23 2016 +0000
+++ b/main.cpp	Thu Oct 06 12:58:35 2016 +0000
@@ -1,35 +1,40 @@
 #include "mbed.h"
-#define SERIAL_BAUD 115200  // baud rate for serial communication
-// Homework set 1, excersize 9
-
-// Serial connection with PC
-Serial pc(USBTX,USBRX);
+// #include "HIDScope.h"
+ 
+// Define the HIDScope and Ticker object
+// HIDScope    scope(1);
+Ticker      scopeTimer;
+ 
+// Read the analog input
+AnalogIn    a0(A0);
+DigitalOut  led(LED_RED);
+ 
+const float kTimeLedToggle = .5f;  // period of blinking
+const int kLedOn=0;             // Led on if 0
+ 
+// The data read and send function
+void scopeSend()
+{
+    // scope.set(0,a0.read());
+    // scope.send();
+}
 
-AnalogIn pot(A0);
-DigitalOut led(D7);
-
-const float kTimeReadToggle = 0.5f;
-volatile float potvalue=0.0;
-
-void readanalog(){ 
-    printf("AnalogOut: %f \n\r", potvalue);
-    }
-
+void SwitchLed(){
+    led = not led;
+}
+ 
 int main()
 {
-    // Set baud connection with PC
-    pc.baud(SERIAL_BAUD);
-    pc.printf("\r\n ***THERMONUCLEAR WARFARE COMMENCES*** \r\n");
-    
-    Ticker tick_toggle_read;
-    tick_toggle_read.attach(readanalog,kTimeReadToggle);
+    led = not kLedOn;
     
-    while(true){
-        potvalue = pot.read();
-        if(pot > 0.3f){
-        led=1;
-        } else {
-        led=0;
-        }    
-        }
+    // Create ticker
+    Ticker tick_toggle_led;
+    tick_toggle_led.attach(SwitchLed,kTimeLedToggle);
+    // Attach the data read and send function at 100 Hz
+    // scopeTimer.attach(scopeSend, 1e4);
+   
+    
+    
+    
+    while(true);
 }
\ No newline at end of file