Manual override

hi, there could you please tell me how to make changes to this code so when I try to turn on for example the light manually, the Bluetooth data would override the sensor data? I'm new to Arduino btw

int light_detect = A5;
int lightval;
int night_whitelight=12;
int temp_thermistor=A2;
int tempval;
int blue_cooler=4;
int red_heater= 7;
int buzzer_firealarm=8;

char BluetoothData;

void setup() {
// put your setup code here, to run once:
pinMode (light_detect, INPUT);
pinMode(night_whitelight, OUTPUT);
pinMode(temp_thermistor, INPUT);
pinMode (blue_cooler, OUTPUT);
pinMode(red_heater, OUTPUT);
pinMode(buzzer_firealarm, OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
if (Serial.available()) {
BluetoothData =; //Get next character from bluetooth
if (BluetoothData == 'D') digitalWrite (red_heater, HIGH);
if (BluetoothData == 'd') digitalWrite (red_heater, LOW);
if (BluetoothData == 'E') digitalWrite (blue_cooler, HIGH);
if (BluetoothData == 'e') digitalWrite (blue_cooler, LOW);
if (BluetoothData == 'L') digitalWrite (night_whitelight, HIGH);
if (BluetoothData == 'l') digitalWrite (night_whitelight, LOW);
if (BluetoothData == 'F') digitalWrite (buzzer_firealarm, HIGH);
if (BluetoothData == 'f') digitalWrite (buzzer_firealarm, LOW);


tempval = analogRead(temp_thermistor);
int newTempVal = map(tempval, 0, 1023, 0, 100);
Serial.print( "reading from thermistor is " );
if (tempval<400) {
digitalWrite (red_heater, HIGH);
if (tempval>450) {
digitalWrite(red_heater, LOW);
if (tempval>560) {
digitalWrite(blue_cooler, HIGH);
if (tempval<530) {
digitalWrite(blue_cooler, LOW);
if (tempval>600) {
digitalWrite(buzzer_firealarm, HIGH);
if (tempval<570) {
digitalWrite(buzzer_firealarm, LOW);

lightval= analogRead(light_detect);
int newLightVal = map(lightval, 0, 1023, 0, 100);
Serial.print("reading from photoresistor is ");
if (lightval<=200) {
digitalWrite(night_whitelight, HIGH);
if (lightval>=201) {
digitalWrite(night_whitelight, LOW);


The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

1 Like

How to "manually override" what?

there is a heater, cooler, light, and fire alarm, so each one come on at a specific time for example when its hot according to the thermistor cooler comes on, but I want to be able to turn on the cooler manually as well but when I do it comes on for less than second then goes off, I know it because of the sensor code which turns off the cooler in this case, I need to make changes to the code so when I turn on the cooler via Bluetooth app stays on and ignore the sensor code?

So when you override, you want to ignore the sensor. Is this for ever or is there a timeout? How should the system resume automatic control?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.