Giter VIP home page Giter VIP logo

Comments (7)

SolidSoils avatar SolidSoils commented on September 27, 2024

Method SetAnalogReportMode is used to command an Arduino board to send a continuous stream of sampled values. GetPinState retrieves a pin's single value.

I cannot reproduce the issue.

from arduino.

Oluntridao avatar Oluntridao commented on September 27, 2024

The same think happens to me. I always receve 0 value when i execute getPinState.

from arduino.

Angelusvetus avatar Angelusvetus commented on September 27, 2024

I also have similar problems. I see a tremendous number of posts with the same questions. I feel the solidsoils library is well written. However, to date, I have not been able to find anyone providing information on using the analog side of solidsoils. 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 rarley in question.

It would be very helpful if someone could provide a short example in C#/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.

from arduino.

zoopyserg avatar zoopyserg commented on September 27, 2024

ZEEEEEEEEEEROOOOOOOOOOOO,
THIS CODE GIVES ZERO:

PinState result = session.GetPinState(14);
UpdateStatusListBox(result.Value.ToString());

Can anyone here do their job properly?

from arduino.

SolidSoils avatar SolidSoils commented on September 27, 2024

Hi @zoopyserg, I am feeling your pain. ;-) Software development can be frustrating.

Your struggle may be caused by a misconception about what GetPinState actually does. This library is based on the standard firmata protocol that is described here. What GetPinState actually does is described here.

from arduino.

zoopyserg avatar zoopyserg commented on September 27, 2024

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).
To get it to work for analog pins, people need to toss in this line somewhere inside static void SimpelTest:

firmata.SetAnalogReportMode(5, true);

Which then makes that code magically trigger the callback private void Session_OnAnalogStateReceived which contains the correct recording of an analog pin.

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'm a hero here.

from arduino.

SolidSoils avatar SolidSoils commented on September 27, 2024

@zoopyserg, this SimpelTest is part of a basic and informal tool I only created for testing the software. I hope to fix the documentation soon and add some proper examples though.

Besides, IFirmata.SetAnalogReportMode does not trigger the callback. It sends a message to the Arduino board telling it to start or stop sending analog state change messages. The ArduinoSession object routes these messages to the OnAnalogStateReceived event.

Regarding the open connections: it is the Windows OS that is keeping serial port connections open for some time. There is no (easy) way to work around that behaviour as it is hidden somewhere in the system32 dll's. Serial port connections are closed asynchronously by the OS, so even when you close the connection in .NET, behind the scenes it still remains open for some time.

from arduino.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.