Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
don't even know what all the PORTA TRISA and ADCON0 ADCON1 stuff's about.
the compilers don't support my board and many commands don't work
#include <p18f4520.h>#include <delays.h>//////CONFIG BITS////////////////#pragma config WDT = OFF //watchdog timer#pragma config OSC = HS //oscillator set to high speed#pragma config LVP = OFF //low voltage program off#pragma config MCLRE = ON //mclr pin active (frees up RE3)//////////////////////////////////#define flasher PORTDbits.RD0 // this sets the word //flasher to represent //pin0 on port Dvoid main(){ TRISD = 0b00000000; //set all pins on port D to be output PORTD = 0b00000000; //set all pins on port D to be low (0v) while(1){ if(flasher == 0){ //if the pin is off flasher = 1; //turn it on (send 5v out of the pin) } else{ flasher = 0; //otherwise it must already be //on so turn it off (set the pin to 0v) } Delay10KTCYx(80); //set a delay (adjusting the value) //in brackets adjusts the speed //of the port turning on and off) }}
#include "delay.h"
TRIS = 0b11101;
__CONFIG (MCLREN & UNPROTECT & WDTDIS & INTRC);
#pragma config WDT = OFF //watchdog timer#pragma config OSC = HS //oscillator set to high speed#pragma config LVP = OFF //low voltage program off#pragma config MCLRE = ON //mclr pin active (frees up RE3)
How about a matt finish white block? That shouldn't give bad readings will it?
IR sensor has problems detecting distances furthur than 30cm... I'll need it to operate btwn 10-60cm though, any thoughts why? thanks again