I’m a Freshmen in POE, and I have a task to create a crane that moves and lowers a basket and stops.
"A construction contractor needs your team to design a crane that can rotate 90 degrees and lower a basket 18 inches for supplies to be moved around the job site. The crane should be run with a series of buttons and switches that can activate the rotation, lowering, and raising of the basket. The device must also be able to be started and stopped (emergency) by using a switch. "
As of now this is the code that I have came up with,
#pragma config(Sensor, dgtl1, bumpSwitchstart, sensorTouch)
#pragma config(Sensor, dgtl2, bumpSwitchstop, sensorTouch)
#pragma config(Sensor, dgtl3, limitSwitchdrop, sensorTouch)
#pragma config(Sensor, dgtl4, limitSwitchup, sensorTouch)
#pragma config(Motor, port1, craneMotor, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port9, craneServo, tmotorServoStandard, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task estop()
{
while(true)
{
if(SensorValue(estopsensor) <500)
{
stopAllTasks();
}
wait1Msec(10);
}
}
task main()
{
startTask(estop);
while(true)
{
if(SensorValue(bumpSwitchstart)==1)
{
setServo(craneServo, 90);
}
if(SensorValue(bumpSwitchstop)==1)
{
setServo(craneServo, -90);
}
if(SensorValue(limitSwitchdrop)==1)
{
startMotor(craneMotor, 1);
wait(18);
stopMotor(craneMotor);
}
if(SensorValue(limitSwitchup)==1)
{
startMotor(craneMotor, -1);
wait(18);
stopMotor(craneMotor);
}
}
}
I need help too see if this will actually work, and if it doesn’t what I can do to fix it. Since I do not have a cortex at my house.
Thanks.