We are trying to mimic a mood ring effect onto a Teddy Bear by using RGB leds and sensors while using the adafruit Flora.
We have the code and have been modify it and have had a few successes but are currently stuck because we keep getting the same error. Which is that expected initializer should be before 'int'.
//TMP36 Pin Variables
int temperaturePin = 0; //input: the analog pin the TMP36 is connected
//RGB LED pins
int led DigitalOne[]= {9,10,12};//output: the three digital pins of the RGB LED
int Red Pin 9;
9 = int temperature 60;
int green Pin 10;
10 = int temperature = 60;
int Blue Pin 12;
12 = int temperature = 60;
const int ON= HIGH;//(255)
const int OFF= LOW; //(0)
const int DIM= 100;
//predefined Colors
const int RED[]= {
255,0,0};
const int DARKGREEN[]={
0,100,0};
const int LIGHTBLUE[]={
135,206,250};
const int BLUEVIOLET[]={
138,48,226};
const int DARKORANGE[]={
255,140,0};
const int WHITE[]={
255,255,255};
const int BLACK[]={
0,0,0};
void setup()
{
// initialize serial communication with computer:
Serial.begin(9600);
// initialize all the temperature pin to 0:
for (int thisReading = 0; thisReading < numReadings; thisReading++)
readings[thisReading] = 0;
}
{
for(int i=0;i< 3;i++);
{
pinMode (ledDigitalOne[i],INPUT) ;//SET THE RGB LED PINS AS OUTPUTS
}
Serial.begin(9600); // start the serial connection with the battery
}
void loop ()
{
float celsius = get Voltage(1);//getting the voltage reading from the temp sensor
celsius= ( celsius-.5)* 100; // converting 10mv per degree with 500 mv offset
// to degrees (( voltage - 500 mv )*100)
float fahrenheit = (celsius * ( 9.0/ 5.0))=32.0;
data[1]=(int) fahrenheit;
}
Serial.println (newTemperature);// printing the result
delay(7000);// waiting 7 seconds to get a new result
//Set the three LEDs to any predefined color depending of the temperature in F
if ((newTemperature > 40) && (newTemperature <= 71)) {
setColor (ledDigitalOne, BLACK);
Serial.println("BLACK");
}
else if ((newTemperature >= 72)&&(newTemperature <= 73)) {
setColor(ledDigitalOne, WHITE);
Serial.println("WHITE");
}
else if ((newTemperature >=74) && (newTemperature <= 75)){
setColor(ledDigitalOne, DARKORANGE);
Serial.println ("DARKORANGE");
}
else if ((newTemperature>=76) && (newTemperature <= 77)){
setColor (ledDigitalOne, BLUEVIOLET);
Serial.println("BLUEVIOLET");
}
else if ((newTemperature>=78) && (newTemperature <= 79)){
setColor (ledDigitalOne, LIGHTBLUE);
Serial.println("LIGHTBLUE");
}
else if ((newTemperature>=80) && (newTemperature <= 81)){
setColor(ledDigitalOne, DARKGREEN);
Serial.println("DARKGREEN");
}
else if ((newTemperature>=82) && (newTemperature <= 83)){
setColor(ledDigitalOne, RED);
Serial.println("RED");
}
float getVoltage int add (int pin)
{
return (analogRead (pin) *. 004882813);
//converting from a 0to 1024 digital range
//to 0 to 5 volts (each 1 reading equals ~ 5 milivolts)
}
// Function to set the color
void setColor (int* led, int *color){
for (int i= 0; i<3;i++){
digitalWrite (led[i], color[i]);
}
}
// A version of setColor that allows for using const int colors
void setColor(int* led, const int*color){
int tempColor[]= {
color[0],color[1], color[2] };
setColor(led, tempColor);
}