int main() {
while(1) {
while(true){
if( Controller1.ButtonL2.pressing()) {
solenoid.set( true );
}else if( Controller1.ButtonL1.pressing()){
solenoid.set( false );
}
wait(15, msec);
}
int main() {
while(1) {
while(true){
if( Controller1.ButtonL2.pressing()) {
solenoid.set( true );
}else if( Controller1.ButtonL1.pressing()){
solenoid.set( false );
}
wait(15, msec);
}
What are you trying to do?
What do you want help with?
What language?
What do you mean “try with blocks then to text”?
Firstly, when you post code, please use 3 backticks (`) so that the code is automatically formatted nicer.
Secondly, you did not actually say what is wrong. It would help a lot if you specify what is not working with your code.
Two things that I can see are wrong with the code you are posting, although this does not look like the full code. I will make comments based on the limited information you have posted.
Firstly, you are missing multiple closing braces for your int main()
function and while(1)
loop. Secondly, there is almost no reason to have the code:
while(1) {
while(true) {
// code here
}
}
Both of these while
statements are loops that will run forever. Delete the while(1)
loop at the top.
Please give us more information so that we can better help you.
im trying to code some solenoids to triport C but when i run the code nothing happens, im using C++.
didn’t notice i paste it wrong
int main() {
while(1) {
while(true){
if( Controller1.ButtonL2.pressing()) {
solenoid.set( true );
}else if( Controller1.ButtonL1.pressing()){
solenoid.set( false );
}
wait(15, msec);
}