led veranderen edhv pot

Dependencies:   C12832

Committer:
arthur_2000
Date:
Mon Feb 10 10:37:44 2020 +0000
Revision:
7:b8018fce578f
Parent:
6:f8cb706c480c
Kleur led veranderen aan de hand van potentiometers

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dreschpe 0:f6a57b843f79 1 #include "mbed.h"
chris 3:2db94ee076ee 2 #include "C12832.h"
dreschpe 0:f6a57b843f79 3
chris 4:39c7c31b8fb0 4 // Using Arduino pin notation
chris 4:39c7c31b8fb0 5 C12832 lcd(D11, D13, D12, D7, D10);
arthur_2000 7:b8018fce578f 6 PwmOut r (D5);
arthur_2000 7:b8018fce578f 7 PwmOut g (D8);
arthur_2000 7:b8018fce578f 8 PwmOut b (D9);
arthur_2000 7:b8018fce578f 9 AnalogIn pot1 (A0);
arthur_2000 7:b8018fce578f 10 AnalogIn pot2 (A1);
arthur_2000 7:b8018fce578f 11
dreschpe 0:f6a57b843f79 12 int main()
dreschpe 0:f6a57b843f79 13 {
arthur_2000 7:b8018fce578f 14
arthur_2000 7:b8018fce578f 15 while(1) {
arthur_2000 7:b8018fce578f 16 lcd.cls();
arthur_2000 7:b8018fce578f 17 lcd.locate(0,3);
arthur_2000 7:b8018fce578f 18 lcd.printf("Pot 1 = %.2f", (float)pot1);
arthur_2000 7:b8018fce578f 19 lcd.locate(0,14);
arthur_2000 7:b8018fce578f 20 lcd.printf("Pot 2 = %.2f", (float)pot2);
arthur_2000 7:b8018fce578f 21
arthur_2000 7:b8018fce578f 22 r = pot1;
arthur_2000 7:b8018fce578f 23 g = pot2;
arthur_2000 7:b8018fce578f 24 b = pot1;
arthur_2000 7:b8018fce578f 25 wait(0.1);
arthur_2000 7:b8018fce578f 26 }
dreschpe 0:f6a57b843f79 27
arthur_2000 7:b8018fce578f 28
arthur_2000 7:b8018fce578f 29
arthur_2000 7:b8018fce578f 30
dreschpe 0:f6a57b843f79 31 }