rgb

Dependencies:   C12832

main.cpp

Committer:
depraeterem
Date:
2021-02-12
Revision:
0:7439776e01b6

File content as of revision 0:7439776e01b6:

/* mbed Microcontroller Library
 * Copyright (c) 2019 ARM Limited
 * SPDX-License-Identifier: Apache-2.0
 */
#include "mbed.h"
#include "C12832.h"

// Using Arduino pin notation
C12832 lcd(D11, D13, D12, D7, D10);

PwmOut r (D5);
PwmOut g (D8);
PwmOut b (D9);

AnalogIn pot1 (A0);
AnalogIn pot2 (A1);

int main()
{ 
    while(true) {   // this is the third thread
            r = 1.0 - (float)pot1;
            g = 1.0 - (float)pot2;
            b = 1.0 - ((float)pot1 + (float)pot2);  
            wait (0.01);
            lcd.cls();
        lcd.locate(0,3);
        lcd.printf("Pot 1 = %.2f", (float)pot1);
        lcd.locate(0,14);
        lcd.printf("Pot 2 = %.2f", (float)pot2);
        wait(0.1);
    }
}