Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef motorite
- #define motorite
- #define F_CPU 1000000UL
- #include <avr/io.h>
- #include <util/delay.h>
- #include <stdlib.h>
- #include <stdio.h>
- void PinSet (int pin);
- void move (int pin, int pwm );
- void move (int pin, int pwm)
- {
- PinSet(pin);
- while(1)
- {
- TCCR1A |= 1<<WGM11 | 1<<COM1A1 ;
- TCCR1B |= 1<<WGM13 | 1<<WGM12 | 1<<CS10;
- ICR1 = 1024;
- OCR1A =pwm;
- }
- }
- void PinSet (int pin)
- {
- if(pin=1)
- {
- PORTB |= 1<< PINB0 ;
- PORTB &= ~(1 << PINB2);
- }
- if(pin=0)
- {
- PORTB |= 1<< PINB2 ;
- PORTB &= ~(1 << PINB0);
- }
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement