I am in the process of developing an Arduino application that can read keystrokes from a PS/2 keyboard. I was wondering if it would be possible to upload a C# program onto the Arduino to interpret the keystrokes from the keyboard and write an Arduino program to perform operations based on the keystrokes.
-
No, the Arduino doesn't run C#Majenko– Majenko2015-08-20 20:06:21 +00:00Commented Aug 20, 2015 at 20:06
-
Is there a specific feature of C# you need help working around in C++?BrettFolkins– BrettFolkins2015-08-21 01:05:40 +00:00Commented Aug 21, 2015 at 1:05
-
C# is just my go to language. I haven't dabbled in C++ at all, but I guess this would be a good time to pick it up.user83489– user834892015-08-21 01:34:50 +00:00Commented Aug 21, 2015 at 1:34
2 Answers
The answer is actually, surprisingly, yes! C# requires .NET CLR for execution, I had assumed that .NET exists only in microsoft desktop land, but it has in fact been ported to microcontrollers and released open source as .NET micro, it can even run baremetal with no OS.
However this is not possible on an 8 bit regular arduino, it requires one of the larger 32 bit models. There is a prebuilt clone that has the .NET micro CLR framework ported to it on an STM32F4 cpu called the netduino
Unfortunately the footprint for .Net Micro is too large to run on a regular 8bit arduino and probably hasn't been built for 8bit systems. It is possible with the arduino Due (in theory) and on other micrcontroller platforms that support .NET micro to run C# code outside of the windows platform.
-
This is interesting... will this work on something like Arduino Due or another 32 bit Arduino board?Anonymous Penguin– Anonymous Penguin2015-08-20 21:12:30 +00:00Commented Aug 20, 2015 at 21:12
-
@AnnonomusPenguin it requires reasonable resources (256K Flash + 64K ram), but otherwise the devil will be in configuring/building it for the Arduino Due platform, I'm not sure how easy Microsoft makes it on you, I couldn't find anyone working on it after a cursory search for .net micro on arduino duecrasic– crasic2015-08-20 21:16:39 +00:00Commented Aug 20, 2015 at 21:16
I hope this answer doesn't get voted down just because it addresses the generic need (do something upon input from a PS/2 keyboard), rather than the (too) specific question that was asked (use c# on Arduino), but here it comes ...
If you use a PS/2 to USB adapter for the keyboard, you can select a much easier solution, based, for example, on raspberry PI (or anything that runs linux and has a USB master port) and use any simple scripting language - even shell. The overall cost would not be much higher and the ease of implementation would be definitely more likely to succeed. And in a short time.