BMT M9 groep 7
/
halfgeleider
test halfgeleider
Revision 1:f2ec9d10960a, committed 2015-10-28
- Comitter:
- Margreeth95
- Date:
- Wed Oct 28 20:10:38 2015 +0000
- Parent:
- 0:b8edd42c7819
- Commit message:
- Werkend script voor aansturing transistor
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b8edd42c7819 -r f2ec9d10960a main.cpp --- a/main.cpp Thu Oct 15 14:09:42 2015 +0000 +++ b/main.cpp Wed Oct 28 20:10:38 2015 +0000 @@ -1,45 +1,40 @@ #include "mbed.h" #include "HIDScope.h" -DigitalOut pin1(D0); -DigitalOut pin2(D1); -DigitalOut led(LED_RED); -AnalogIn pin3(A0); -HIDScope scope (3); +DigitalOut pin1(D4); +AnalogIn testpin(A0); +HIDScope scope (2); Ticker scope2; +Serial pc(USBTX, USBRX); void ScopeSend() { scope.set(0, pin1); - scope.set(1, pin3); - scope.set(2, 1); - + scope.set(1, testpin); scope.send(); } int main() { - scope2.attach(&ScopeSend, 0.01); - led.write(1); - pin2 = (1); - + pc.baud(115200); + scope2.attach(&ScopeSend, 0.002); + while (true) { - pin1 = (0); - wait (2); - pin1 = (1); - wait (2); + char c = pc.getc(); - if (pin3 >= 0.1) + if (c == 'f') { - led.write(0); - } + pin1 = (1); + wait (2); + pin1 = (0); + wait(1); + } else { - led.write(1); - } - } + pin1 = (0); + } } - \ No newline at end of file +} \ No newline at end of file