Go Down

Topic: In function 'void loop()':... (Read 3866 times) previous topic - next topic

ReCreate

I don't really see what i did wrong, But this is the error i get when i try to compile/upload something.
Code: [Select]
In function 'void loop()':
error: invalid conversion from 'int' to 'const uint8_t*'

The code is:
Code: [Select]
#include <Tone.h>
Tone tone1;
int spkpin = 9;//the speaker (digital PWM)pin is 9
int note = 440;
int singlebyte = 0;
void setup()
{
 tone1.begin(spkpin);
 pinMode(9,INPUT);
 Serial.begin(9600);
}

void loop()
{
 
note = analogRead(1);
singlebyte = map(note,0,1023,0,255);
tone1.play(note);//plays the current note
Serial.write(singlebyte, BYTE);

}


And something in this line
Code: [Select]
Serial.write(singlebyte, BYTE);
Is causing it to go kaput.
I don't see what could possibly be wrong here.  :o
Any ideas?
Thanks
~ReCreate

AlphaBeta

Try Serial.print not Serial.write :]

ReCreate


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!

Arduino
via Egeo 16
Torino, 10131
Italy