The cable can be moved from linux to windows and the sketch will upload so seems to be a Linux issue. The linux laptop is up to date and has been booted multiple times. I have tried this on multiple boards, I have built 3 of the same device. Any help is much appreciated.
output after upload
Sketch uses 3940 bytes (13%) of program storage space. Maximum is 28672 bytes.
Global variables use 265 bytes of dynamic memory.
avrdude: stk500_disable(): unknown response=0x30
Code: Select all
// SPDX-FileCopyrightText: 2011 Limor Fried/ladyada for Adafruit Industries
//
// SPDX-License-Identifier: MIT
// thermistor-2.ino Intermediate test program for a thermistor. Adafruit Learning System Tutorial
// https://learn.adafruit.com/thermistor/using-a-thermistor by Limor Fried, Adafruit Industries
// MIT License - please keep attribution and please consider buying parts from Adafruit
// which analog pin to connect
#define THERMISTORPIN A0
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 10
// the value of the 'other' resistor
#define SERIESRESISTOR 100000
int samples[NUMSAMPLES];
int outputpin = 8; // triggers relay driver
bool ison = false; // devind ison as true/false for relay
void setup(void) {
pinMode(outputpin, OUTPUT); // pin that drives relay
Serial.begin(9600);
// connect AREF to 3.3V and use that as VCC, less noisy!
analogReference(EXTERNAL);
}
void loop(void) {
uint8_t i;
float average;
// take N samples in a row, with a slight delay
for (i=0; i< NUMSAMPLES; i++) {
samples[i] = analogRead(THERMISTORPIN);
delay(10);
}
// average all the samples `out
average = 0;
for (i=0; i< NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES;
Serial.print("Average analog reading ");
Serial.println(average);
//Below on and off has to be set per sensor as the value are different from sensor to sensor
if (ison) { // will be true if we have turned on the power to the relay and fan
if ( average > 483 ){ // If we get bounce increase this
digitalWrite(outputpin, LOW); // Turn off relay
Serial.println("Relay Off");
ison = false;
}
}else{
if ( average < 470 ){
digitalWrite(outputpin, HIGH); // Turn on relay to run fan
Serial.println("Relay On");
ison = true;
}
}
delay(1000);
}