thanks, already got it workingTo run code two times:
Code:for (i = 1; i <= 2; i++) { your code... }
you know I come on here for help with different concepts, and I was actually asking you to elaborate a little on how these terms and functions you use actually work in the program, while(true) for example. I don't deny that I'm still a beginner with code and microcontrollers. that's why I need help. hence the forum...So answer your own question! Do you still need the for statement? It should be easy to answer because you understand the code so well.
(Sorry for any attitude. I’m trying to make a point)
Ok, I’m sorry. I didn’t mean to make you feel sorry. I was just using a style of teaching that I’m familiar with. I missed that it wasn’t the best style for you. It’s a problem with a forum for me. Visual clues that help in assessing the value of a particular teaching style is missing. Thank you for sharing your personal story. It will help me help you.you know I come on here for help with different concepts, and I was actually asking you to elaborate a little on how these terms and functions you use actually work in the program, while(true) for example. I don't deny that I'm still a beginner with code and microcontrollers. that's why I need help. hence the forum...
but you trying to make me feel bad for not understanding is making me feel like I shouldn't post anything ever. people have different learning styles. I have a disability myself. sometimes reading a book or an article isn't enough. sometimes I cant keep track of 20 different thread responses. that's not a crime. this is a public forum and im allowed to ask questions more than once.
thanks. ive actually encountered this a bit from others on the forum so I have come to understand its part of the culture...youre doing fine I also understand that Im not good with this format. maybe I should try something elseOk, I’m sorry. I didn’t mean to make you feel sorry. I was just using a style of teaching that I’m familiar with. I missed that it wasn’t the best style for you. It’s a problem with a forum for me. Visual clues that help in assessing the value of a particular teaching style is missing. Thank you for sharing your personal story. It will help me help you.
So, with that in mind, where do we stand? So I answer the correct question, can you repeat your last one? I hope you’ll let me try again.
actually I see now. I was reviewing the code and I think I get it nowthanks. ive actually encountered this a bit from others on the forum so I have come to understand its part of the culture...youre doing fine I also understand that Im not good with this format. maybe I should try something else
im just wondering... if halt and while(true) are kinda the same thing in this code, and it is "halting" - "while the statement is true"...why is it outside of those "for" loop brackets and not inside with the instructions for the LEDs to flash and whatnot?
yeah I thought that's what it was doing...like repeating nothing over and overwhile(true); is a simple loop that keeps running as long as true is true, i.e. forever.
A micro, when it is running, is always executing some code. The halt hack (yes, it is a hack) gives it something ti execute forever without having any effect.
Bob
Exactlyyeah I thought that's what it was doing...like repeating nothing over and over
However, in my example, halt refers to a macro or substitution to a do nothing loop. Externally, it looks like a HALT; internally it’s a do nothing loop bwhile (true) ;
computes to code that loops forever. It compiles to:
here: goto here
This is a simple way to make a program hang.
A HALT instruction depends on the compiler and platform. It could be compiled to a statement that returns control to the operating system that invoked the application code in the first place.
In embedded microcontroller applications there is never a need to HALT the program. The system is always running or perhaps in SLEEP mode.
You want to repeat the LEDs flashing, correct? That’s what the for loop does. Repeat the flashing. If you were to put the do nothing loop inside the for loop, it would no longer repeat. It would run once and then do nothing forever.im just wondering... if halt and while(true) are kinda the same thing in this code, and it is "halting" - "while the statement is true"...why is it outside of those "for" loop brackets and not inside with the instructions for the LEDs to flash and whatnot?