Group 2 PES tuttorial 3 led werkt niet met pot

Dependencies:   FastPWM MODSERIAL mbed HIDScope

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "MODSERIAL.h"
00003 #include "FastPWM.h"
00004 #include "HIDScope.h"
00005 
00006 //DigitalOut ledmbed(LED_RED);
00007 //FastPWM led(D8);
00008 //InterruptIn butt1(D2);
00009 //InterruptIn butt2(D12);
00010 AnalogIn potter(A5);
00011 
00012 MODSERIAL pc(USBTX, USBRX);
00013 
00014 HIDScope scope(1); // We’re going to send 2 channels of data
00015 Ticker Tikkie;
00016 
00017 volatile float brightness;
00018 volatile float brightness_prev = 0;
00019 
00020 void ReadPot()
00021 {
00022     brightness = potter;
00023     scope.set(0, brightness);
00024     brightness_prev = brightness;
00025     scope.send();
00026 }
00027 
00028 int main()
00029 {
00030     Tikkie.attach(&ReadPot,0.01);
00031     while (true) {};        
00032 }