Additional Codework on Distance_Sensor
This commit is contained in:
parent
d7ac8f546a
commit
dc8b1cde31
3 changed files with 10 additions and 4 deletions
|
@ -595,8 +595,8 @@ void uart1_puts_p(const char *progmem_s )
|
||||||
|
|
||||||
int8 Init_TWI(void){
|
int8 Init_TWI(void){
|
||||||
TWAR = OWN_ADR; /*!< Eigenen Slave Adresse setzen */
|
TWAR = OWN_ADR; /*!< Eigenen Slave Adresse setzen */
|
||||||
TWBR = 12; /*!< Setze Baudrate auf 100 KHz */
|
TWBR = 64; /*!< Setze Baudrate auf 100 KHz */
|
||||||
/*!< 4 MHz xtal */
|
/*!< 16 MHz xtal */
|
||||||
TWCR = (1<<TWEN); /*!< TWI-Interface einschalten */
|
TWCR = (1<<TWEN); /*!< TWI-Interface einschalten */
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -51,6 +51,9 @@ public:
|
||||||
this->slaveAddr = 0;
|
this->slaveAddr = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initialiate the sensor
|
||||||
|
srf10_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -44,6 +44,9 @@ Robot::Robot()
|
||||||
//Activate interrupt
|
//Activate interrupt
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
// Initialiate TWI
|
||||||
|
Init_TWI();
|
||||||
|
|
||||||
//Interface
|
//Interface
|
||||||
for(uint8 i = IO_START; i < IO_END; i++)
|
for(uint8 i = IO_START; i < IO_END; i++)
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue