2

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 Aug 20 '15 at 20:06
  • Is there a specific feature of C# you need help working around in C++? – BrettAM Aug 21 '15 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 Aug 21 '15 at 1:34
1

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.

| improve this answer | |
  • This is interesting... will this work on something like Arduino Due or another 32 bit Arduino board? – Anonymous Penguin Aug 20 '15 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 due – crasic Aug 20 '15 at 21:16
0

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.