-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SolidSoils Arduino Firmata Analog Methods #33
Comments
Using Standard Firmata with an Arduino Due, I had no luck at all using 'GetPinState' to work on either analog or digital pins - does anyone have more luck or more info on this? But I've been successfully using the ReportMode mechanism, wherein you subscribe to changes in analog state, e.g.
and an event handler like this:
Sorry I haven't got time to do a complete example, but maybe you can piece it together from the above? HTH, |
It is late here, but I will take a closer look at this in the morning. It looks promising, and I do appreciate you taking the time to share this information. Again, Thank You. Best Regards, Rhett |
Hi Jim, I looked at the snippet you posted. I was not able to get it to work. I am sure it is good code, but I should have mentioned in my original post that I am entry level in programming. My original goal was just to have a ProgressBar control display the analog input (A0) value (I.e. myProgressBar.Value = myArduinoAnalogInputPin's value). I think this should be easy to do, but after many hours of trying to get this to happen, I have been unsuccessful at getting my head wrapped around what is and what should be happening here. Everything in this solidsoils library has a tutorial for using with C# out there with one exception... anything analog. I was having trouble with subscribing and the event handler. I could not get the .OnNext to show up in the intellisense and the "this" keyword threw errors on converting between form and AnalogState. If you could give a brief description of the sequence of events that should take place for this, that would be greatly appreciated. If you do not have time to mess with it, I understand also. Thank You Sir. Rhett |
@ Angelusvetus Hi Rhett,
I'm assuming that your class derives from another class of yours called 'YourDevice',, otherwise it's just:
Hope this helps a bit! |
Hi Jim, That did help tremendously! I very much appreciate the help you have provided Sir. Best Regards, Rhett |
That's great. Check out: state.Channel ! And data in state.Level. |
Hi Jim, You are a Genius! I do appreciate and thank you for the information and help you provided. Again Thank You Sir! Best Regards, Rhett |
My pleasure! I wish I was a genius... If you're in that 'OnNext' method in Visual Studio, you can just type 'state.' and a list of state's members should popup (Intellisense). Best, |
How hard can it be to spend 20 minutes and provide a working example? |
Everyone here is way too polite to people who don't finish the job they've started. If you post an answer, just post full files, and not "add this line" and a couple of pagedowns later "add this line too". |
So many "geniuses" and two years later after the initial response, there is no code example. I hate open-source projects. |
Hi @zoopyserg, the discussion above is about a solution built on Observable properties. It is a concept belonging to MVVM (Model View Viewmodel) as it is used in Windows Presentation Foundation. When you are not familiar with MVVM you may be better off by using the good old events. You can request an Arduino board to send pin state updates by issueing an |
This file from the SolidSolis repo contains a full working example of both Analog and Digital signal processing: https://github.com/SolidSoils/Arduino/blob/master/Solid.Arduino.Run/Program.cs Everything that starts with this: static void SimpelTest And until the end of the file. But out of the box, it is also incomplete (sets up the callbacks, but starts listening for only digital pins). firmata.SetAnalogReportMode(5, true); Which then makes that code magically trigger the callback After that I need to solve the problems with parallel threads and busy open Arduino connections which is still work in progress. This is the answer I was looking for. |
I am having trouble reading a value on pin A0(14) of an Arduino UNO.
I see a tremendous number of posts with people having the same issues. I feel the SolidSoils library is well written. However, to date, I have not been able to find much information on using the analog side of this library. All responses are vague and without example. There are a multitude of videos and text articles on the digital side. However, the digital side is not my issue, it is intuitive and I have no problem getting it to work. I don't know if multiple analog methods have to be called or in place before checking the state/level of the analog input pin. I have set the pinmodes… what next? The syntax gives only information for that particular method, it does not help if knowing that other methods have to be called or what they are. The tutorials I have found for this library are all digital for C#/C#.NET. Really would like to find a good tutorial on the analog side of the library.
It would be very helpful if someone could provide a short example in C#.NET that reads an analog value from Analog input pin A0 on the Arduino UNO using Firmata. This would be most helpful. The internet and myself would be most grateful.
The text was updated successfully, but these errors were encountered: