I am very new to arduino and coding in general, and am trying to compete a project for my new kitchen. I am doing under cabinet lighting and am wanting to use an arduino with capacitive touch sensor to turn on my led ballast via pwm, and also have a few brightness settings. Basivally ON, Dim1, Dim2, and off, im sure pretty simple for anyone experienced at programming. I purchased a DAC and i know i have to make an opamp circuit to double the voltage for my ballast ( input is 0-10 volts not pwm ). I think i am going to buy a pwm ballast to make things cleaner but for now this is what i have.
I have managed to hack together other peoples code to get the capacitive sensor working, and the led but i need some help finishing the project. The code is attached that i have managed to get working. Let me know what this would cost, thanks!!
Thanks for the reply Pat. I have a few capacitive touch sensors as well as made one myself ( I plan to use some of the same metal for my countertop edge, anodized aluminum) the sensor is not the hard part for me it's getting the code going. I really do not know how to code, or even really edit code. Just managed to find someone else's code that almost does what I need.
Here's a snapshot of what the main loop should look like, with the capacitive sensor, based on the Capacitive Sensor library by Paul Bagder: CapacitiveSensor
void loop() {
static unsigned long last_triggered = 0;
// check status of touch sensor, if we're outside of the lockout period
if (millis() - last_triggered >= Lockout) {
if (Touch_Sensor.capacitiveSensor(Touch_Sensor_Samples) > Touch_Sensor_Threshold) {
Controller.Set_Trigger(Button_Pressed);
last_triggered = millis();
}
}
// update lighting control state machine
Controller.Update();
}
The rest of the code manages the OFF -> ON -> MED -> LOW -> OFF state control logic.