I am very very new to all of this. Well doing it myself to some degree. I have friends / people that program for a living and do more of a real PLC for the equipment that I build. I ask them about this type of code and the laugh so they are no help. I just don't understand, I get an era, I want to know WHY?? this is my question
I have the book Programming Arduino, Next Steps plus a few others . I followed exacily what the book said for the sketch and got this ' Timer1' not declared in the sketch
Its hard to learn when the teaching info don't work?
I would think they should be the same. I am reading an example sketch from a book. ( book is about Arduino programming)
What am I trying to do? lol I don't know the lesson in the book was going to explain it. I tried changing it to...int Timer1=0;
now it says "request for member " initialized" in timer one ; witch is non class of int"
This was going to show me how timer library's work. or something like that. This is not the first time this has happened same problem from different books. I don't know. Its like learning math and the book says 2+2=4 so u input 2+2 in the calculator and get 7 .
Thanks for trying to help. i don't even know how to ask the question.
Did you download the library and put it in the correct spot? It should be in your Mydocuments/Arduino/libraries folder, if it is not then you will get errors.
I'm not familiar with the TimerOne library, but in general it will follow the pattern of the servo library. For example
#include <Servo.h> // include the library
Servo myservo; // create a servo object called myservo
setup() {
my servo.attach(7); // initialize the myservo object and attach it to pin 7
myservo.write(120); // tell myservo to move to an angle of 120 degrees
}
void loop() {
}
You are probably getting the error because you don't have the equivalent of "Servo myservo;"
You seem to have created an integer called Timer1 rather than a TimerOne object. Integers don't understand the methods "initialize" or "pwm". I don't see why a timer would respond to pwm either, but maybe it does.
You will need to study the instructions or examples for TimerOne to find out the exact requirements.
I do not know myself i was just following the information I was given. ( from a book that has serious flaws).
I did need to add some downloads in. I did not learn what I set out to try and learn but did learn other things so all in all i am a little better off. i have not had that NOW I GET IT!!! moment.
I am very very new to all of this. Well doing it myself to some degree. I have friends / people that program for a living and do more of a real PLC for the equipment that I build. I ask them about this type of code and the laugh so they are no help. I just don't understand, I get an era, I want to know WHY?? this is my question
Great friends that don't want to help, good to see you are still going to continue and trying things step by step.
I'm not familiar with timer1 either, you can edit the subject of this thread, include TIMER1 in the subject, it will attract more members who have used this library.
I just downloaded the TimerOne library then tried your code and it compiles fine.
I followed exacily what the book said for the sketch and got this ' Timer1' not declared in the sketch
Where exactly is the library, post the exact address. If you don't know how to get the address, find the TimerOne folder, highlight and right click to properties, the address is there. I am unfamiliar with MAC computers, so your on your own there.
Also, you don't need to have "TimerOne Timer1" as Robin2 suggested, because it is already declared in the library.