Esempio n. 1
0
int main(void)
{
	initRobotBase(); // Always call this first! The Processor will not work
					 // correctly otherwise. 
	
    writeString_P("\nRP6 Stopwatch Demo Program\n");
	writeString_P("__________________________\n\n");

	// Start all used Stopwatches:
	startStopwatch1();
	startStopwatch2();
	startStopwatch3();
	startStopwatch4();

	// Set a stopwatch to a specific initial value:
	setStopwatch2(1600);
	
	// Main loop
	while(true) 
	{
		// Here we call the four "tasks" we have.
		// You should poll each stopwatch
		// in it's own function like it is done here, this keeps the sourcecode 
		// a bit more tidy. (In the RP6 Manual you can find an example
		// which has this within the main method)
		task_LEDs();
		task_counter1();
		task_counter2();
		task_counter3();
	}
	return 0;
}
Esempio n. 2
0
int main(void)
{
	initRP6M256(); 
	initLCD();

	// ---------------------------------------
	WDT_setRequestHandler(watchDogRequest); 

	// ---------------------------------------
	I2CTWI_initMaster(100);  
	I2CTWI_setRequestedDataReadyHandler(I2C_requestedDataReady);
	I2CTWI_setTransmissionErrorHandler(I2C_transmissionError);


	setLEDs(0b1111);
	mSleep(1000);
	setLEDs(0b0000);
	
	// ---------------------------------------
	// Setup ACS power:
	I2CTWI_transmit3Bytes(I2C_RP6_BASE_ADR, 0, CMD_SET_ACS_POWER, ACS_PWR_OFF);
	// Enable Watchdog for Interrupt requests:
	I2CTWI_transmit3Bytes(I2C_RP6_BASE_ADR, 0, CMD_SET_WDT, true);
	// Enable timed watchdog requests:
	I2CTWI_transmit3Bytes(I2C_RP6_BASE_ADR, 0, CMD_SET_WDT_RQ, true);

	startStopwatch1();
	startStopwatch2();
	startStopwatch3();
	
	while(true) 
	{ 
		/*
		mSleep(600);
		warnForObs();
		mSleep(600);
		task_checkINT();
		mSleep(600);
		light_detection();
		mSleep(600);
	    task_I2CTWI();
		mSleep(600);*/
		writeIntegerLength_WIFI(adcBat,DEC,4);
		behaviourController();
	}
	return 0;
}