Shop OBEX P1 Docs P2 Docs Learn Events
Converting Arduino to PBASIC — Parallax Forums

Converting Arduino to PBASIC

ProxyProdigyProxyProdigy Posts: 7
edited 2009-06-18 03:55 in BASIC Stamp
Do any of you know of a good tool that converts Arduino code to PBASIC to be ran on the BS2?

Comments

  • pwillardpwillard Posts: 321
    edited 2009-06-17 23:19
    This is probably not the answer you want. The best tool is in your head. PBASIC (a dialect of standard basic) and Arduino code (a dialect of C) are such niche code environments that you won't find a specific tool for the job. There exist a C to BAS translators... but they will get you as far as you can probably get on your own.

    I also find it VERY odd that anything that was done for the Arduino has not also been done for PBASIC based controllers. If your translation project it is unique to Arduino... it's likely because it takes advantage of somthing that is UNIQUE to the arduino.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    There's nothing like a new idea and a warm soldering iron.
  • ProxyProdigyProxyProdigy Posts: 7
    edited 2009-06-17 23:29
    It's actually very simple code that I'm wanting to convert. I can and will just do it manually. But, I thought I'd ask if there is anything like that out there that would make it easier for a guy I'm trying to help with a project. He's very new to electronics and programming and has found several projects for the arduino that he's trying to duplicate using the Homework Board kit that he picked up at RadioShack. One of the projects he's trying to duplicate is an EMF detector that he found on Make. I don't have time to convert all of the code for all of his projects, but I do think that he learns better from actual code examples rather than reading tutorials or me trying to figure out how to explain things to him. Right now I'm going to convert a simple program for using an LED and photoresistor to detect colors (like M&M's) and then control 2 servos (one will turn a cup holder and the other will simply push the M&M into the appropriate cup). I told him I would help with this one since I too would like to have something like that.

    Thanks anyways for your help and speedy feedback.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-06-18 02:41
    I rather doubt that there's a translation program available; but wow! converting Arduino code to PBASIC is a very worthwhile objective! I wish you well with it!

    -Phil
  • FranklinFranklin Posts: 4,747
    edited 2009-06-18 03:55
    I've found in most cases the easiest way is to break the code into it's subroutines and then treat each as it's own miniprogram. Commenting the original code also helps as when you are writing the new code you have a description of what is going on in english (if that is your language) and you can say 'how would I do that in pbasic.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.