Pages: [1]   Go Down
Author Topic: In function 'void loop()':...  (Read 1931 times)
0 Members and 1 Guest are viewing this topic.
From:0x000000
Offline Offline
Full Member
***
Karma: 0
Posts: 213
sudo make me a (bread+ham+lettuce+cheese+bread)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't really see what i did wrong, But this is the error i get when i try to compile/upload something.
Code:
In function 'void loop()':
error: invalid conversion from 'int' to 'const uint8_t*'
The code is:
Code:
#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:
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
Logged

Norway@Oslo
Offline Offline
Edison Member
*
Karma: 12
Posts: 2033
loveArduino(true);
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try Serial.print not Serial.write :]
Logged

From:0x000000
Offline Offline
Full Member
***
Karma: 0
Posts: 213
sudo make me a (bread+ham+lettuce+cheese+bread)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

oOops my bad.
Thanks!
Logged

Pages: [1]   Go Up
Jump to: