#define led 3 // the PWM pin the LED is attached to
int off = 0; // how bright the LED is when off
int full = 255;
double Thermister(int RawADC) { //Function to perform the fancy math of the Steinhart-Hart equation
double Temp;
Temp = log(((10240000 / RawADC) - 10000));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp )) * Temp );
Temp = Temp - 273.15; // Convert Kelvin to Celsius
Temp = (Temp * 9.0) / 5.0 + 32.0; // Celsius to Fahrenheit - comment out this line if you need Celsius
return Temp;
}
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
Serial.begin(115200); //This code sets up the Serial port at 115200 baud rate
}
void loop(){
analogWrite(led, full); // turns LED on until disconnected or program stops running
// STARTS READING TEMP
int val; //Create an integer variable
double temp; //Variable to hold a temperature value
val = analogRead(0); //Read the analog port 0 and store the value in val
temp = Thermister(val); //Runs the fancy math on the raw analog value
Serial.println(temp); //Print the value to the serial port
delay(1000);
}
I can verify my code and it does that just fine but when I go to upload it gives me the error: Error uploading, check if the selected board is currently available, and nothing else. I am using the arduino uno on windows 7 via the online web editor. The other forums on this topic do not answer the question. Any ideas on how to get rid of this error?
Which COM port is your is your Arduino using ? Look at the Ports entry in Device Manager if you are using Windows
In the Web editor hover your cursor over the text box to the right of the upload arrow where the board type is displayed. What does the board type say and what does the popup message say ?
Noting happened when I hovered over the text box. I don't know what is supposed to be there. I attached an image of what it looks like. Is it possible that something happened to remove the ports from the online IDE? If so what would I need to do to fix this? Thanks for the help!
No I don't have the desktop version downloaded only the online version and when I hover nothing shows. Also, when I open the drop down only the board type shows up, nothing about a port.
If so, what shows in Device Manager ?
When you plug in the Arduino to a USB port does anything change in Device Manager and does Windows notify you of the connection ?
If you are using Linux or a Mac then I can be of little help I am afraid
Incidentally, when you print from the program where do you expect to see the output from the sketch on the Arduino ?
Yes I am using windows just not the desktop version. I am using the online version. As a result I don't have a "device manager". I expect that I would see some values of around 70 (that is the temperature in the office). Although I have not been able to test this yet as I can't get it to upload.
UKHeliBob:
Oh yes you do. It is part of the Windows OS
But where would you see them when the code is running on the Arduino board as you do not have the IDE installed ?
What? I don't see any device manager on my online editor. I expect to see the values on the "monitor" portion of the online IDE. BTW when I open this section of the online IDE I see that it says "Port: no serial port available"
jordanakins:
I don't see any device manager on my online editor.
Device Manager is not part of Arduino Web Editor. It is a part of the Windows operating system. You can start it like this:
Click on the Start button.
Click "Control Panel".
Click "Hardware and Sound".
Click "Device Manager", which you will see under "Devices and Printers".
Once Device Manager is open, you can click on "Ports (COM & LPT)" to see a listing of all the available ports on your computer. If you unplug your Uno, one of the ports should disappear. If you plug your Uno back in, one of the ports should reappear. That is the port you need to configure Arduino Web Editor to use. If no port shows for your Uno in Device Manager then there is some hardware problem we need to resolve.
I see what your are saying now. I though you meant as a part of the Arduino Editor Program. I had my system admin look at the install for the plugin associated with the online version of the IDE and it turns out the the plugin installed but not the drivers for the Uno board. As such I downloaded the driver for the Uno board and now everything works perfect. Thanks for trying to help and hopefully this can help anyone else with similar problems.