Use of hitechnic light sensor
Closed this issue · 1 comments
DomeD13 commented
Hi there,
I didn't find anything for using the hitechnic light sensor. Is there any way to use it?
LaiYanKai commented
This script is about 1.5 years old. The syntax may have changed. This assumes u use the HiTechnic Color Sensor V2, and only one sensor (the HT sensor) is connected to the port you are using. The default port is 2.
The code at the bottom uses port 3. If you wanna change the port used, just change 3 to something else.
'--------------------- Sensor ReadCommands ----------------------------
F.Start = HTC
F.Function("HTC", "P:2")
Sub HTC
F.ReturnNumber(Sensor.ReadI2CRegister(F.Get("P"), 1, 66))
EndSub
F.Start = HTR
F.Function("HTR", "P:2")
Sub HTR
F.ReturnNumber(Sensor.ReadI2CRegister(F.Get("P"), 1, 67))
EndSub
F.Start = HTG
F.Function("HTG", "P:2")
Sub HTG
F.ReturnNumber(Sensor.ReadI2CRegister(F.Get("P"), 1, 68))
EndSub
F.Start = HTB
F.Function("HTB", "P:2")
Sub HTB
F.ReturnNumber(Sensor.ReadI2CRegister(F.Get("P"), 1, 69))
EndSub
F.Start = HTW
F.Function("HTW", "P:2")
Sub HTW
F.ReturnNumber(Sensor.ReadI2CRegister(F.Get("P"), 1, 70))
EndSub
'---------------- Poll HT Sensor at port 3 -----------------------
CI_R = F.Call1("HTR", 3)
CI_G = F.Call1("HTG", 3)
CI_B = F.Call1("HTB", 3)
CI_W = F.Call1("HTW", 3)