Giter Club home page Giter Club logo

arduinodriver's People

Contributors

christophediericx avatar prankard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduinodriver's Issues

analog pin references

Hi there again,

Thanks for the new features in the latest version. I noticed a few issues while testing it on my project:

  1. I could not find enum values for analog pins in the library references. Are they implemented?

2)Also I'm not sure whether it's the project which I'm working on but I'm experiencing drops in performance whenever I switch between different method arguments on the Driver e.g. switching between arduinodriver overload 1 and 2 and switching from Leonardo to Uno boards.. I'm suspecting serial port event handler but this problem is way over my head :(

Thanks again for putting this out there for us non-engineers!

Can only upload to Mega2560 once!

I have an issue if I try to upload to a Mega2560 I can do it once but if I stay in the app and try a second time it does nothing. It just waits and I have crash out of my app. If I restart my app I can then upload again. I know its not my app as it doesn't do the same with NanoR3 or UnoR3, they work. I know its not my board as I dont have the same issue with the Arduino IDE.

2 bug-fixes for 2.1.0 release..

Hi Chris.

I've been testing your interface for use as a bridge between real-things and a flight-simulator model via the Arduino. Figured out a few problems you might want to include in the next version to save others from head-scratching !!

1/ ArduinoListner.ICO file ..

You've got a bug %line 127 for digitalPinToRead .. it should use data[2] instead of data[0].

2/ In latest release - ArduinoDriver.cs - method InitializeWithoutAutoBootstrap()

You have a port.Close() after the handshake... this shouldn't be there (creates load of problems)... change the code to be

if (handshakeResponse == null)
{
port.Close();
Port.Dispose();
throw exception..
}

Cheers

Gary

Type or Namespace ArduinoModel could not be found

I have just cloned this project and restored missing Nuget packages, yet everywhere I see in code the type ArduinoModel is highlighted in red because the compiler doesn't recognize it from anywhere. Is there a setup step or a dependency on another project i have missed or something? I can't wait to get started with this amazingly helpful looking tool.

Using in Unity3d

Hi,
i want to use you library in Unity3d and i will get an error which i don't know to handle. I've switched your Project and Unity3D to .net 4.6 and both are working correctly (separate).
The ArduinoUploader.dll and RJCP.SerialPortStream.dll are compiled also with 4.6

When i will start the Project in Visual Studio the Music sounds out of the Arduino correctly

I've copied the following files to unity:
ArduinoDriver.dll
ArduinoDriver.dll.config
ArduinoUploader.dll
IntelHexFormatReader.dll
NLog.dll
RJCP.SerialPortStream.dll
RJCP.SerialPortStream.xml

When i will start my Project and send the Music to the Arduino the yellow LED is blinking and i will get the following error:

IOException: Device Error
RJCP.IO.Ports.SerialPortStream.WriteCheckDeviceError () (at :0)
RJCP.IO.Ports.SerialPortStream.WriteCheck (System.Byte[] buffer, System.Int32 offset, System.Int32 count) (at :0)
RJCP.IO.Ports.SerialPortStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) (at :0)
ArduinoUploader.BootloaderProgrammers.ArduinoBootloaderProgrammer.Send (ArduinoUploader.BootloaderProgrammers.Protocols.IRequest request) (at :0)
ArduinoUploader.BootloaderProgrammers.Protocols.STK500v1.Stk500V1BootloaderProgrammer.EstablishSync () (at :0)
ArduinoUploader.ArduinoSketchUploader.UploadSketch (System.Collections.Generic.IEnumerable`1[T] hexFileContents) (at :0)

I know ist not directly your issue but i'm hoping that you can identify the Problem when you see the error message. May be some files missing?

THX Forward!!!

How to use Arduino lib in C#?

I want some Arduino lib but i don't know how to use Arduino lib in c#
I searched it so i get some info about dll but how to make arduino lib to dll, too
how can i do it?

External Analog Reference

Please could you add "external analog reference" functionality to your program as without it the Arduino Uno R3 has very poor analog read accuracy as Vcc (default reference) varies.

I have looked into adding it in myself.
The easiest way, I assume, would be a to add the command to ArduinoListener.ino file but I was unsuccessful in compiling the new required ArduinoListener.ino.UnoR3.hex due to Arduino IDE compiler errors.

The other option I believe is to add the command set to all required files (to the library) but again without the ability to generate the required hex file this would be all for nothing.

Thanks
DynastyORiGiN

upload

Hi!
Thanks a bunch for this library first off, amazing effort.
I haven't had much time yet to parse and implement majority of features in this,
is it possible to upload the code to the microcontroller or produce an arduino code from the library?

Thanks in advance.

Digital Write not working as expected

I am writing high to digital pin 52 on my ATMega2560 (Made by Elegoo/Amazon, not arduino) and the write function is not behaving correctly. I can tell that the arduino is receiving the serial commands but the high command is not putting out a full 5v to the digital pin when I turn it on. I can see the LED connected to PIN 52 turns on but I have to have all lights off in my room to see it. I tested the chip by uploading a sketch from arduino IDE and it behaves as expected with a nice bright flash from the led.

Here is the code I am using:

using ArduinoDriver;
using ArduinoDriver.SerialProtocol;
using ArduinoUploader.Hardware;

namespace StillController
{

class Program
{

    static void Main(string[] args)
    {

        var driver = new ArduinoDriver.ArduinoDriver(ArduinoModel.Mega2560, "COM7", true);
        
        driver.Send(new DigitalWriteRequest(52, DigitalValue.High));

        System.Threading.Thread.Sleep(1);
    }
}

}

LED HIGH example

hello I'm a noob who is trying to understand how the arduinodriver is working, but i can't find anything basic how the driver is working.
could some maby send me sort of a sample to turn on a led.

Using Arduino Uno, but not r3

Will this cause an error?

when I execute the sample code against my arduino uno, which does not explicitly say it is r3 (so i am assuming it isn't) it fails on the handshaking. The arduino works with the normal arduino IDE.

is this driver compatible with the older uno?

Support for Arduino 101

I'm assuming it's not already in since I didn't see it on the readme, but if you could get support for the Arduino 101, that'd be awesome.

New possibilities

Hi,

Thank you very much to share your fantastic job with us.

I wanted to know if you think to include One-Wire and I2C possibilities and a 3.5 framework version to try to use it with Unity 3D.

Thank you again.

Arduino Leonardo board crash over manufacturer bootloader

I constantly program Leonardos on Lattepandas(DFRobot) and it always crash if I use this program on manufacturers bootloader, but using Arduino IDE always work on first;

Programming after new bootloader is in does always work;

It sticks on: COMN - Port still present...

AnalogRead

Does anyone know how to read in an analog value to c# from the Arduino UNO using the ArduinoDriver? I am trying to read in the value from a pressure sensor connected to the Arduino and store it as an int in my c# code. Thanks!

Read Analog input

Thanks for the great contribution! I am new to the coding world.
Can you give an example how to read an Analog input? I can use Digital WriteRequest to toggle the Digital pin. I saw your Buzzer example. Do you need to define the PinMode first? Thanks!

Frank

Read and write multiple values with one request

Reasoning

As it stands now reading and writing multiple values at once can be quite slow. Writing a digit to a 7-digit display takes around 85 ms. That is a long time taken just to write output to seven pins.

General proposal

I propose that new options are added to the protocol. The names are unimportant so I'll refer to the additions as ExtendedRead and ExtendedWrite. These cover both analog and digital operations.

The protocol extensions would be similar to the current implementations. The extensions would send the amount of operations (operation referring to reading or writing a pin) to the board, along with the needed pin information to complete the operations.

Reading

Request

For reading this would simply be a number, eg. 3, and a list of the pins to read. An example could look like this:

var response = driver.Send(new ExtendedDigitalReadRequest(3, 4, 5);

The only parameter to the ExtendedDigitalReadRequest constructor would be a single params parameter containing all the pins.

Response

The response to a ExtendedReadRequest would be similar to the current ones. Instead of containing the readings for a single operation it would contain an array with an entry for every operation requested. The type of the array depends on the type of ExtendedReadRequest. The type would be DigitalValue for digital and byte for analog. The ordering of the response would have to match the ordering of the original request.

Another option is wrapping the pin information in a struct. That would make the relationship between pin and reading more explicit, but would also require more protocol overhead.

Writing

Request

Writing to multiple pins is slightly trickier. I suggest wrapping the pin and DigitalValue value in a struct.

struct DigitalWriteInfo { byte Pin { get; set; } DigitalValue Value { get; set; } }

The constructor is omitted from the above declaration. An example call with three values would then look like this:

var response = driver.Send(new ExtendedDigitalWriteRequest(new DigitalWriteInfo(2, DigitalValue.High), new DigitalWriteInfo(3, DigitalValue.Low), new DigitalWriteInfo(4, DigitalValue.Low)));

The syntax is very verbose, and there might be a better way to handle it, but I believe the intention is clear.

Response

The response to a ExtendedWriteRequest is similar to the response to a ExtendedReadReqeuest. I believe the explanation and reasoning in that section also covers the current section.

Feel free to ask for clarification if you need it.

Command line arguments expect C:\Users\chris\Desktop\sketch.hex to exist

The Debug Start options in the SketchUploader project configuration expect the following command line arguments:

--port=COM3 --file="C:\Users\chris\Desktop\sketch.hex"

Can you clarify what this file is supposed to contain? Can I generate it with the sample code, or do you need to share it along with the rest of the project?

Access to COM denied.

Hello! Thanks for taking the time to write up this library. I'm having an issue I can't pin down. When I try to create an instance of ArduinoDriver I get an UnauthorizedAccessException stating it couldn't access the COM port. I ran your compiled sample code and it worked just fine. However, I tried compiling the source for the sample code and it receives the same error.

I'm using a UNOR3 via USB and VS 2015. Communications should be fine since your compiled sample worked flawlessly, but my test programs and me compiling your sample source does not. Let me know if you need additional information. Nothing else should have a hold on the COM port; I also tried manually entering the COM port using the overloaded constructor.

Another thing I noticed is that even though I have the ArduinoDriver Nuget Package installed and have access to the DLL, I need to specify the ArduinoDriver class using the namespace like so: "ArduinoDriver.ArduinoDriver". Adding "using ArduinoDriver;' doesn't remove this issue. I don't think it's a problem, just found it odd.

I'd like to test out your library and see if it fits my needs, but I can't get past the COM access. Please advise on what I should do to get past this. Thanks!

DigitalWrite Issue

Hi,
Firstly, I apologize for the such basic question. I'm trying to do DigitalWriteRequest, but seems it's not working properly because pin value doesn't change. DigitalReadRequest returns "High" value instead of expected "Low" value.
Is there something wrong with my code below?

using (var driver = new ArduinoDriver.ArduinoDriver(ArduinoModel.UnoR3, true))
{
driver.Send(new DigitalWriteRequest(13, ArduinoDriver.DigitalValue.Low));
Thread.Sleep(1000);
var digitalReadResponse = driver.Send(new DigitalReadRequest(13));
var readValue = digitalReadResponse.PinValue;
}

Thanks,
teapottiger

Servo motor functions

Hello,

I would like to suggest adding a way to control servo motors with this library.

Usually, with an Arduino, one would simply use the "Servo.h" library to control a servo motor. However, when using this library, one must recreate the whole PWM functions since a servo motor is expecting a 40Hz frequency which isn't really obtainable by using analogWrite commands.

I beleive it could help greatly to have such a function :) (if there already is one and I simply couldn't find it, I'm sorry and could you please point me in the right direction?)

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.