C
C#10mo 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
Buddy10mo 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
AceChewy10mo 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
Jimmacle10mo 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
RumTery10mo 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
Jimmacle10mo 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
AceChewy10mo 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
Jimmacle10mo ago
you could just use pseudocode at that point
AceChewy
AceChewy10mo ago
Yh, understand the logic and then learn the syntax
Jimmacle
Jimmacle10mo ago
yep
AceChewy
AceChewy10mo ago
Thanks for the help
Accord
Accord10mo 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
More Posts
✅ Questions about castingHi all, I'm looking to simplify some network code I've got. Networking doesn't really play too large❔ c# wpf change background color of whitespace characterI've been at it for a few hours and i just cant seem to get it to work, i've tried keypress events a❔ .NET installation not recognized, but command worksI am trying to install .NET Core 7. The installation goes smoothly and I can run the command, but li❔ Need a hand on creating something i am doing on fiddler which involve web traffic editingI've never done anything dealing with web traffic programmically so this is somewhat new to me but h❔ Why is Pop() necessary here??So I found a sample solution for the LeetCode decode string puzzle https://leetcode.com/problems/decI don't really get how to create new methods for my code. Yesterday people told me it's got no body.Didn't really understand anything when i did research. It's probably a quick fix : ] I'm talking ab❔ MC3050 compiler errorI added a new project with some custom WPF controls to my project's dependencies. I then added the ✅ Function For Division Game Showing Same Number Twice???```cs public void StartDivGame(string username, DateTime date, int totalQuestions, string difficultygoto vs recursionHello, I have a little question about "good habit" in this block of codes. So a little context is, t❔ What's the best way to test a URL that's it's valid?I have a situation where the user can enter a URL if they so choose, but if they do, I want to ensur