void update(sf::RenderWindow *mWindow, Player *player, sf::View *view)
{
	tick++;
	//std::cout << "tick: " << tick << std::endl;
	checkForEvents(mWindow);
	checkForInput(mWindow, player, view);
	player->Update();
	//world->Step(1, 8, 3);
}
Exemple #2
0
int main()
{
	init_motors();
	init_peripherals();



	// find out how many cells are connected

	u16 batteryCutoff;
	while((batteryCutoff = getBatteryVoltage()) == 0);
	if(batteryCutoff > 720) // voltage is higher than 6V -> 2cells
		batteryCutoff = 720;	// cutoff 6V
	else
		batteryCutoff = 360; 	// cutoff 3V


	calibrate_sensors();
	// enable interrupt driven gyro acquisation
	startGyro();



	u08 c = 0, maxThrust = (batteryCutoff>360)?70:100;
	u08 cutBattery = 0;
	while(1) {

		if(Thrust > maxThrust)
			Thrust = maxThrust;
		calculate_balance(Thrust, Yaw, Pitch, Roll);


		checkForInput();


		// check battery
		if(((c%100)==0)) {

			u16 bat = getBatteryVoltage();
			if(bat > 0 && bat <= batteryCutoff) {
				if(maxThrust > 0)
					maxThrust -= 5;
				cutBattery = 1;
			}
		}

		if(!cutBattery || !(c % 50))
			PORTC ^= (1<<2);
	
		c++;
		//_delay_ms(100);
	}

}
void main() {
    char keyNum = 0;
    keypadSetup();
    rs232Setup1(); // setup the serial port

    while (1) { // just loop for test
        keyNum = (char) checkForInput() + '`';
        Write1USART(keyNum);

        Delay1KTCYx(1);
    }

}