Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Hi,
Is it possible to set up a PIC 16F876 to receive IR data and increase/decrease the PWM output depending on the data received?
Many thanks!
Device = 18F2550
Clock = 8
Config FOSC = INTOSCIO_EC
Include "INTOSC8.bas"
Include "PWM.bas"
Include "IR_UART.bas"
Dim Variable As Byte
// start of main program
PWM.SetFreq(38000)
PWM.SetDuty1(50)
PWM.Start1
IR_UART.SetTX(PORTC.2)
IR_UART.SetMode(umTrue)
IR_UART.SetBaudrate(sbr300)
Variable = 0
Low(PORTC.0)
While True
Inc(Variable)
IR_UART.Write(Variable)
DelayMS(500)
Wend
Device = 18F2550
Clock = 8
Config FOSC = INTOSCIO_EC
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.0
#option LCD_EN = PORTB.1
Include "INTOSC8.bas"
Include "IR_UART.bas"
Include "convert.bas"
Include "lcd.bas"
Dim Variable As Byte
IR_UART.SetRX(PORTC.2)
IR_UART.SetMode(umTrue)
IR_UART.SetBaudrate(sbr300)
DelayMS(150)
LCD.Cls
LCD.WriteAt(1,1,"IR UART")
While True
IR_UART.Read(Variable)
LCD.WriteAt(2,1,Convert.DecToStr(Variable,3))
Wend
Great code Gramo I never noticed that Swordfish has an IR module, I can't wait to give it a try.