Thursday, July 6, 2017

Arduino Software Downloads

Main Software:

  1. Arduino IDE  

  2. CH340 for Windows 


 

CH340for Other OS (Windows, MAC, Linux), https://sparks.gogo.co.nz/ch340.html

 

Other Software 其他開發環境:

mBlock

S4A

S4A Firmware

Python

 

 

WeMos D1

Monday, July 3, 2017

Thermometer using TO-92 with Light Indicator



 

//This program sense temperature using TO-92 to A0 analog input, with lighting indicator to digital pin 2,3,4, and output voltage level through serial output at 9600bps

//20C -> OFF, OFF OFF

//22C-> ON, OFF OFF

//24C-> ON, ON OFF

//26C-> ON ON ON

 

const int sensorPin = A0;
const float baselineTemp = 20.0;

void setup(){
Serial.begin(9600);

for(int pinNumber = 2; pinNumber<5; pinNumber++){
pinMode(pinNumber,OUTPUT);
digitalWrite(pinNumber, LOW);
}
}

void loop(){
int sensorVal = analogRead(sensorPin);
Serial.print("Sensor Value: ");
Serial.print(sensorVal);

float voltage = (sensorVal/1024.0) * 5.0;
Serial.print(", Volts: ");
Serial.print(voltage);
Serial.print(", degrees C: ");
float temperature = (voltage -0.5) * 100;
Serial.println(temperature);

if (temperature < baselineTemp){
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
}else if (temperature >= baselineTemp+2 &&
temperature < baselineTemp+4){
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
}else if (temperature >= baselineTemp+4 &&
temperature < baselineTemp+6){
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
}else if (temperature >= baselineTemp+6){
digitalWrite(1, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
}
delay(1);
}

Resistor Color Code

https://www.digikey.com/en/resources/conversion-calculators/conversion-calculator-resistor-color-code-4-band