Exemplo n.º 1
0
int main() {
	setup();
	displayWelcome();
	displayBattery();
	lineCalibration();

	followLineLaps(4);

	play_from_program_space(success);
	clear();
	print("Done.");
	while (true); // prevent exit from main
	return 0; // dead code
}
Exemplo n.º 2
0
task usercontrol()
{
	startTask(trackBallsFired);
	startTask(flywheelTBHControl, 30);

	while (true)
	{
		driveRC(lDriveControl*0.875, rDriveControl);
		intakeRC(inRollerButton, outRollerButton, upIntakeButton, downIntakeButton);
		flywheelRC(&flywheel);

		displayBattery();
	}
}
Exemplo n.º 3
0
int main() {
    setup();
    //displayWelcome();
    displayBattery();
    unsigned char b = lineCalibration();


    int numTurns = 0;
    const int MAX_TURNS = 8;
    char turns[MAX_TURNS+1];

    if (b == BUTTON_B) {
        numTurns = followTrack(turns, MAX_TURNS);

        clear();
        if (numTurns <= MAX_TURNS) {
            //play_from_program_space(success);

            turns[numTurns] = '\0';
            print(turns);
        } else {
            print_long(numTurns);
            print(" turns.");
        }
    } else if (b == BUTTON_A) {
        bool l = false;
        bool r = false;
        bool s = false;
        followSegment(l, r, s);
        clear();
        if (l) {
            lcd_goto_xy(0,1);
            print("L");
        }
        if (s) {
            lcd_goto_xy(4,0);
            print("S");
        }
        if (r) {
            lcd_goto_xy(7,1);
            print("R");
        }
    }
    while (true); // prevent exit from main
    return 0; // dead code
}
Exemplo n.º 4
0
boolean Gamebuino::update() {
    if (((nextFrameMillis - millis()) > timePerFrame) && frameEndMicros) { //if time to render a new frame is reached and the frame end has ran once
        nextFrameMillis = millis() + timePerFrame;
        frameCount++;

        frameEndMicros = 0;
        frameStartMicros = micros();

        backlight.update();
        buttons.update();
        battery.update();

        return true;

    } else {
        if (!frameEndMicros) { //runs once at the end of the frame

            sound.update();
            updatePopup();
			displayBattery();
            display.update(); //send the buffer to the screen
			if(!display.persistance)
				display.clear(); //clear the buffer

            frameEndMicros = micros(); //measure the frame's end time
            frameDurationMicros = frameEndMicros - frameStartMicros;

            //            display.setTextColor(BLACK);
            //            display.setCursor(0, 40);
            //            display.print(frameDurationMicros / timePerFrame);
            //            display.print(" ");
            //            display.print(2048 - freeRam());

            //            display.setCursor(0, 32);
            //            display.print("CPU:");
            //            display.print(frameDurationMicros / timePerFrame);
            //            display.println("/1000");
            //            display.print("RAM:");
            //            display.print(2048 - freeRam());
            //            display.println("/2048");
        }
        return false;
    }
}