IS there a client library for C#?

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
himoh82538
 
Posts: 3
Joined: Fri May 28, 2021 11:45 pm

IS there a client library for C#?

Post by himoh82538 »

Basically, I want to do the following thing, that I do on a microcontroller, on a desktop C# Windows application (Ethernet).

Code: Select all

AdafruitIO_Feed *digital = io.feed("digital");
  io.connect();
  digital->onMessage(handleMessage);
Is there a library that does the same thing in C# on Windows? I have searched the NuGet, and the top result was AdafruitClassLibrary, but it just says that it is "Library for Adafruit hardware under Windows IoT Core", so I am not sure if this is what I am looking for. I am trying to receive feed events on a regular Windows PC.

User avatar
x00syn4ps3
 
Posts: 7
Joined: Thu Sep 19, 2019 11:59 pm

Re: IS there a client library for C#?

Post by x00syn4ps3 »

Hey how's it going?

So, even though I'm not an active Adafruit contributor, I do use a ton of various microcontrollers on a regular basis for doing little side projects. I've been planning on putting together a desktop application at some point in the near future to pull Adafruit IO feed data and display it on the app, to save from having to always open up a browser and pull up IO that way. When I get around to it I can let you know, but in the mean time, I would highly recommend using something a lot more simple and direct to achieve your goals..i.e. NOT using C#.

Granted, I have only worked on a small number of C# programs. I have however had a blast at writing tons of python applications that communicate with Adafruit IO using their helper libraries. I have a GitHub repo that uses regular Python running on a Raspberry Pi to communicate with AIO to publish sensor readings from a Pimoroni Enviro Feather. They included it in the contrib section of their repo. I encourage you to check it out, as well as the Adafruit "Blinka" library, which my program uses. It's an abstraction layer that allows you to use regular Python to interact with sensors, as well as use the Adafruit IO helper libraries to send and retrieve values.

If you are only pulling feed data, you shouldn't even need Blinka, just pip install the adafruit-io package!!!

Check it out!

https://github.com/dedSyn4ps3/EnviroPlus-FeatherWing
https://pypi.org/project/adafruit-io/

User avatar
brubell
Learn User Page
 
Posts: 2010
Joined: Fri Jul 17, 2015 10:33 pm

Re: IS there a client library for C#?

Post by brubell »

Is there a library that does the same thing in C# on Windows?
We don't have a C# library. You'll want to find a library (likely Microsoft provides something native for C#) that can perform HTTP web requests. We have a fully documented HTTP API here: https://io.adafruit.com/api/docs

User avatar
jhale85446
 
Posts: 4
Joined: Mon Mar 22, 2021 1:53 pm

Re: IS there a client library for C#?

Post by jhale85446 »

I am working on a C# HTTP library right now and hope to have it posted to my Github in the next few weeks depending on time. Sending and receiving data and receiving time are working. I still need to add functions for feeds, groups, and weather, plus some error handling. I'll post a link in this thread once it is up, in a mostly usable state, and has some examples.

User avatar
jhale85446
 
Posts: 4
Joined: Mon Mar 22, 2021 1:53 pm

Re: IS there a client library for C#?

Post by jhale85446 »

Here is a link to my Adafruit IO C# library. Only HTTP is supported right now. You can download the Nuget package and add it to your projects. I am working on adding more examples and documentation. There are plenty of overloaded methods to make life easy. Constructive feedback, testing, and bug reports are welcome.

I'll be looking into options for MQTT in the future.

https://github.com/sn0wfa11/Adafruit_IO_CS

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”