C
C#14mo ago
AceChewy

❔ Converting code to another Language

So for an engineering/ cs project, we’re making a satellite (lookup CanSat if you want more details) which is in essence an arduino board hooked up with some sensors and it only really supports C ( you can use Python and C# but it’s a bit clunky) so I was wondering whether there were any services which could help convert code to a different language or guide me in converting the c# / Python code into C. I understand this isn’t necessarily a C# problem but I think we hoping someone has an idea. (I’ve got thought about phind ai but I’m not sure how accurate that will be depending on the size of the code).
11 Replies
Buddy
Buddy14mo ago
You just got to convert the logic to the other language. Syntax is different but logic is the same. And not that I know of
AceChewy
AceChewyOP14mo ago
Ah ok, I’m guessing I just need to first understand the logic of the program in c# after I’ve written it and then look up some guides on C logic
Jimmacle
Jimmacle14mo ago
there's no magic way to do it, and trying to get AI to do it will definitely cause more problems than it's worth and C isn't the only option for embedded boards, you can use C++ and Rust too interpreted or garbage collected languages are terrible choices for performance and stability in an environment with resources as limited as an arduino is there a reason you want to write it in C# first? how will you test it if you can't run it on the arduino?
RumTery
RumTery14mo ago
Maybe try chatgpt. It will make mistakes and isn't suitable for large codebase, but at least something Hope this advice finds you
Jimmacle
Jimmacle14mo ago
there are a lot more considerations when writing code for embedded devices than just the syntax for example, dynamic memory allocation/freeing is basically illegal you also have things like interrupts, timers, other low level hardware features that you wouldn't have if you're trying to prototype the code in C# on a desktop computer and significantly less CPU/memory to work with, little to no standard library so if i were you i'd skip writing code in any language other than the one you're actually going to use and learn it as you go
AceChewy
AceChewyOP14mo ago
I'm more familiar with C# syntax and so my thought process was that if I can do it in C#, I could then try and do it in C++ Yh, I think that is really the only option
Jimmacle
Jimmacle14mo ago
you could just use pseudocode at that point
AceChewy
AceChewyOP14mo ago
Yh, understand the logic and then learn the syntax
Jimmacle
Jimmacle14mo ago
yep
AceChewy
AceChewyOP14mo ago
Thanks for the help
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server