Home→Forums→MonoBrick EV3 Firmware→I2C communication PCF8574AP
- This topic has 21 replies, 5 voices, and was last updated 11 years ago by
Anders Søborg.
-
AuthorPosts
-
October 10, 2014 at 22:25 #4884

Tcm0ParticipantAre you sure that the PCF8574AP is no 9V sensor? In that case you would have to use another mode.
October 11, 2014 at 12:48 #4885
Bartłomiej DrozdParticipantyes, PCF need from 2.5V to 6V, so i have correct mode. I really don’t know, what i should do… Maybe is there any option, where i will be able to construct my own byte array to send? Like in NXC?
-
This reply was modified 11 years ago by
Bartłomiej Drozd.
October 11, 2014 at 13:09 #4887
Helmut WunderParticipanthonestly, I think only one of the Mono devs can help. Or try Java instead…?
I also once wanted to start with Mono for an i2c device ( a Microinfinity inertial Gyro) but unfortunately got no help here in this forum so I had to abandon using Mono so far.
October 11, 2014 at 13:29 #4888
Bartłomiej DrozdParticipanti will try with LejOS, but i don’t like Java… And still waiting for help with C# 😉
October 12, 2014 at 12:43 #4889
Bartłomiej DrozdParticipantok, i just tested it with LejOS and now i know, how to use it 😉 i must write to register 0x16 byte array 😉 and here is my test code
public static void Main (string[] args) { EventWaitHandle stopped = new ManualResetEvent (false); ButtonEvents btn = new ButtonEvents (); byte address = 0x70; byte[] data1 = new byte[1] { 0x05 }; byte[] data0 = new byte[1] { 0x0A }; LcdConsole.WriteLine ("hello world!"); pcf pcf = new pcf (SensorPort.In1, address); btn.EscapePressed += () => { LcdConsole.WriteLine("stopped"); stopped.Set (); }; btn.LeftPressed += () => { pcf.WriteReg(0x16, data1); LcdConsole.WriteLine("write data1"); }; btn.RightPressed += () => { pcf.WriteReg(0x16, data0); LcdConsole.WriteLine("write data0"); }; btn.EnterPressed += () => { LcdConsole.WriteLine(BitConverter.ToString(pcf.ReadReg(16, 1))); }; stopped.WaitOne (); }thanks for help 😉
October 13, 2014 at 06:48 #4891
Anders SøborgKeymasterHi there
Sorry I wasn’t able to help along the way – for some reason I did not get an email on updates in this thread. Anyway great work this might be usefull for others. Consider creating a class for this sensor that we can use in the library.
/Anders
October 21, 2014 at 22:30 #4926
Anders SøborgKeymasterHi again
Could you please share the whole class so it can be a part of the monobrick firmware library…
/Anders
-
This reply was modified 11 years ago by
-
AuthorPosts
You must be logged in to reply to this topic.

Follow