Group 2 PES tuttorial 3 led werkt niet met pot

Dependencies:   FastPWM MODSERIAL mbed HIDScope

Committer:
Roooos
Date:
Tue Sep 25 13:20:22 2018 +0000
Revision:
1:b7fafbf4aa28
Parent:
0:5776e1ab09bd
HIDScope_Probeersel;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Roooos 0:5776e1ab09bd 1 #include "mbed.h"
Roooos 0:5776e1ab09bd 2 #include "MODSERIAL.h"
Roooos 0:5776e1ab09bd 3 #include "FastPWM.h"
Roooos 1:b7fafbf4aa28 4 #include "HIDScope.h"
Roooos 0:5776e1ab09bd 5
Roooos 1:b7fafbf4aa28 6 //DigitalOut ledmbed(LED_RED);
Roooos 1:b7fafbf4aa28 7 //FastPWM led(D8);
Roooos 1:b7fafbf4aa28 8 //InterruptIn butt1(D2);
Roooos 1:b7fafbf4aa28 9 //InterruptIn butt2(D12);
Roooos 0:5776e1ab09bd 10 AnalogIn potter(A5);
Roooos 0:5776e1ab09bd 11
Roooos 0:5776e1ab09bd 12 MODSERIAL pc(USBTX, USBRX);
Roooos 0:5776e1ab09bd 13
Roooos 1:b7fafbf4aa28 14 HIDScope scope(1); // We’re going to send 2 channels of data
Roooos 1:b7fafbf4aa28 15 Ticker Tikkie;
Roooos 1:b7fafbf4aa28 16
Roooos 1:b7fafbf4aa28 17 volatile float brightness;
Roooos 1:b7fafbf4aa28 18 volatile float brightness_prev = 0;
Roooos 1:b7fafbf4aa28 19
Roooos 1:b7fafbf4aa28 20 void ReadPot()
Roooos 1:b7fafbf4aa28 21 {
Roooos 1:b7fafbf4aa28 22 brightness = potter;
Roooos 1:b7fafbf4aa28 23 scope.set(0, brightness);
Roooos 1:b7fafbf4aa28 24 brightness_prev = brightness;
Roooos 1:b7fafbf4aa28 25 scope.send();
Roooos 1:b7fafbf4aa28 26 }
Roooos 0:5776e1ab09bd 27
Roooos 0:5776e1ab09bd 28 int main()
Roooos 1:b7fafbf4aa28 29 {
Roooos 1:b7fafbf4aa28 30 Tikkie.attach(&ReadPot,0.01);
Roooos 1:b7fafbf4aa28 31 while (true) {};
Roooos 0:5776e1ab09bd 32 }