The code below is cycling a bulb from dark to bright and back again using h12cout to a L293D motor driver chip on my 20X2 board. This works great and was just a test. I also sent a binary count sequence to four leds on the PCF8574 chip and notice that as they change state a visible flicker occurs on all OFF LEDS. SDA and SCL are tied to VDD via 4k7 resistors.
Any ideas??
Any ideas??
Code:
Symbol IN1 = b.1
Symbol IN2 = b.2
Symbol IN3 = b.3
Symbol IN4 = b.6
Symbol i = b51
Symbol j = b50
HI2CSETUP I2CMASTER, $40, i2cfast, i2cbyte
Start:
sound Speaker, (110,10)
gosub BulbTest1
goto Start
BulbTest1:
j = j + 1
j = j & 15
j = NOT j
i = 20
hi2cout 0,(j)
for w = 30 to 1020 step 70
Speed = w
gosub SetSpeed
gosub MotorA_FWD
pause i
next w
for w = 1020 to 30 step -70
Speed = w
gosub SetSpeed
gosub MotorA_FWD
pause i
next w
hi2cout 0,(j)
j = NOT j ;reinvert j for counting purposes
return
MotorA_FWD:
high IN1
low IN2
return
SetSpeed:
hpwm PWMDIV16, 0,0,%1000,255, Speed
return
Last edited by a moderator: