#pragma config(Sensor, dgtl12, solenoid, sensorDigitalIn)
ask main()
{
while(true)
{
{
if(vexRT[Btn6U] == 1)
{
SensorValue[solenoid] = 1; //activate the solenoid
}
if(vexRT[Btn6D] == 1)
SensorValue[solenoid] = 0; //deactivate the solenoid
}
}
}
Can anyone pls tell me where this goes wrong.
fruitarian:
#pragma config(Sensor, dgtl12, solenoid, sensorDigitalIn)
ask main()
{
while(true)
{
{
if(vexRT[Btn6U] == 1)
{
SensorValue[solenoid] = 1; //activate the solenoid
}
if(vexRT[Btn6D] == 1)
SensorValue[solenoid] = 0; //deactivate the solenoid
}
}
}
Can anyone pls tell me where this goes wrong.
It should be this:
#pragma config(Sensor, dgtl12, solenoid, sensorDigitalIn)
Task main()
{
while(true)
{
if(vexRT[Btn6U] == 1)
{
SensorValue[solenoid] = 1;
}
else if(vexRT[Btn6D] == 1)
{
SensorValue[solenoid] = 0;
}
}
}
You had “ask main” instead of “Task Main,” you were missing several brackets(these: {}) and misplaced one. The second “if” should also be an “else if.” The if statement stuff won’t necessarily cause performance issues but it’s good practice to do it that way