THIS IS THE ERROR MESSAGE
/Users/Desktop/Our_main_sketch/Our_main_sketch.ino: In function 'void loop()':
Our_main_sketch:51:5: error: 'setDecimalsI2C' was not declared in this scope
setDecimalsI2C(0b00000100)
^~~~~~~~~~~~~~
/Users/Desktop/Our_main_sketch/Our_main_sketch.ino: At global scope:
Our_main_sketch:128:1: error: expected unqualified-id before '{' token
{
^
exit status 1
'setDecimalsI2C' was not declared in this scope
THIS IS THE CODE
#include <Servo.h>
unsigned long startTime;
unsigned long currentTime;
const unsigned long period = 1000;
const int Blueservostart = 14000;
const int Pinkservostart = 14000;
const int Aquaservostart = 14000;
const int Blueservostop = 15000;
const int Pinkservostop = 15000;
const int Aquaservostop = 15000;
Servo Blueservo;
Servo Pinkservo;
Servo Aquaservo;
byte i;
int speakerPin = 6;
#include <Wire.h>
const byte s7sAddress = 0x71;
unsigned int counter = 100;
char tempString[10];
void setup() {
Wire.begin();
Serial.begin(9600);
clearDisplayI2C();
s7sSendStringI2C("-HI-");
delay(1000);
setBrightnessI2C(255);
delay(1500);
clearDisplayI2C();
pinMode(7,INPUT_PULLUP); // speaker output
while(digitalRead(7)==HIGH);
Blueservo.attach(8);
Pinkservo.attach(9);
Aquaservo.attach(10);
pinMode(6,OUTPUT);
startTime = millis();
}
void loop() {
currentTime = millis()-startTime;
sprintf(tempString, "%4d", counter);
s7sSendStringI2C(tempString);
if((currentTime>startTime)&(currentTime<10001)){
if (counter < 10000)
setDecimalsI2C(0b00000100)
else
setDecimalsI2C(0b00001000)
}
if(counter>0){
counter--;
delay(100);
}
if((currentTime>Blueservostart)&(currentTime<Blueservostop)){
Blueservo.write(90);}
if(currentTime>Blueservostop)
{Blueservo.write(0);}
if((currentTime>Pinkservostart)&(currentTime<Pinkservostop)){
Pinkservo.write(90);}
if(currentTime>Pinkservostop)
{Pinkservo.write(0);}
if((currentTime>Aquaservostart)&(currentTime<Aquaservostop)){
Aquaservo.write(90);}
if(currentTime>Aquaservostop)
{Aquaservo.write(0);}
if (currentTime>max(Aquaservostop,max(Blueservostop,Pinkservostop))){
startTime = millis();
counter = 100;}
}
void play( char note, int beats)
{
int numNotes = 14;
char notes[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C', 'D', 'E', 'F', 'G', 'A', 'B', ' '};
int frequencies[] = {131, 147, 165, 175, 196, 220, 247, 262, 294, 330, 349, 392, 440, 494, 0};
int currentFrequency = 0;
int beatLength = 150;
{
if (notes[i] == note)
{
currentFrequency = frequencies[i];
}
}
tone(speakerPin, currentFrequency, beats * beatLength);
delay(beats * beatLength);
delay(50);
}
void s7sSendStringI2C(String toSend)
{
Wire.beginTransmission(s7sAddress);
for (int i=0; i<4; i++)
{
Wire.write(toSend[i]);
}
Wire.endTransmission();
}
void clearDisplayI2C()
{
Wire.beginTransmission(s7sAddress);
Wire.write(0x76); // Clear display command
Wire.endTransmission();
}
void setBrightnessI2C(byte value)
{
Wire.beginTransmission(s7sAddress);
Wire.write(0x7A); // Set brightness command byte
Wire.write(value); // brightness data byte
Wire.endTransmission();
}
{
Wire.beginTransmission(s7sAddress);
Wire.write(0x77);
Wire.write(decimals);
Wire.endTransmission();
}