Go Down

Topic: playing more then two tones Simultaneously (Read 876 times) previous topic - next topic


Feb 18, 2012, 02:56 pm Last Edit: Feb 25, 2012, 11:37 pm by ori Reason: 1
im working on a code that generate sound that changes with relation to climate change using an SHT15 temp and humidity sensor and a small speaker.

i dont get why it wont work, the moment im adding another tone.
would love a bit of assistance

cheers //

this is the code:


#include <SHT1x.h>
#include <Tone.h>
#define dataPin  10
#define clockPin 11
SHT1x sht1x(dataPin, clockPin);
Tone tone1;
Tone tone2;
Tone tone3;
Tone tone4;

void setup()
  Serial.println("Starting up");

void loop()
 float temp_c_p1;
 float humidity_p1;
 float temp_x;
 float humidity_y;
 temp_c_p1 = sht1x.readTemperatureC();
 humidity_p1 = sht1x.readHumidity();
 temp_x = (temp_c_p1*5/20);
 humidity_y = (humidity_p1*3/70);

 Serial.print("Temperature: ");
 Serial.print("C / ");
 Serial.print(". Humidity: ");



try to insert a delay after each toneX.play to determine the length of the sound

seems to work with Mario ;): http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1253920105


the idea was to try and play more than two tones at the same time

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131