PINB input ATtiny10

Sample code for digital input (no interrupt)


/* Just a test of reading an input pin
Sherm 10/31/21 Boooooooooo*/
#include <util/delay.h>#define F_CPU 1000000UL

int main(void){ DDRB=0b00000010; //pb1 out and others in PUEB|=(1<<PB2); //enable pull up on pb2 while(1){ //if(! (PINB==0b00000100)){ //read pb2 //works if(!(PINB & (1<<2))){ //read pb2 (I think more proper?) //also works PORTB^=(1<<PB1); _delay_ms(200); } }}