mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
52 lines
882 B
Arduino
52 lines
882 B
Arduino
|
//
|
||
|
// FILE: map2colour_faucet.ino
|
||
|
// AUTHOR: Rob Tillaart
|
||
|
// VERSION: 0.1.0
|
||
|
// PURPOSE: map2colour demo
|
||
|
// DATE: 2021-12-06
|
||
|
// URL: https://github.com/RobTillaart/map2colour
|
||
|
|
||
|
|
||
|
// demo simulates a temperature of a faucet mapped upon 2 colours.
|
||
|
// blue = cold, black is middle, red is hot
|
||
|
|
||
|
|
||
|
#include "Arduino.h"
|
||
|
#include "map2colour.h"
|
||
|
|
||
|
|
||
|
map2colour mct;
|
||
|
|
||
|
// values must be 7 elements in increasing order.
|
||
|
float values[7] = { 0, 10, 15, 25, 40, 100, 125 };
|
||
|
uint32_t faucet[7] =
|
||
|
{
|
||
|
M2C_BLUE, M2C_BLUE, M2C_BLACK, M2C_BLACK, M2C_RED, M2C_RED, M2C_RED
|
||
|
};
|
||
|
|
||
|
|
||
|
void setup()
|
||
|
{
|
||
|
Serial.begin(115200);
|
||
|
Serial.println(__FILE__);
|
||
|
|
||
|
mct.begin(values, faucet);
|
||
|
|
||
|
for (int i = -20; i < 125; i++)
|
||
|
{
|
||
|
uint32_t rgb = mct.map2RGB(i);
|
||
|
Serial.print(i);
|
||
|
Serial.print("\t");
|
||
|
Serial.println(rgb, HEX);
|
||
|
}
|
||
|
Serial.println();
|
||
|
}
|
||
|
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
// -- END OF FILE --
|