Note that there are some explanatory texts on larger screens.

plurals
  1. POC++: Way to create the equivalent of Arduino 'byte' in Xcode
    primarykey
    data
    text
    <p>Background:</p> <p>I am programming an <a href="http://www.atmel.com/devices/atmega328.aspx" rel="nofollow">ATmega328</a>. I can't stand the Arduino IDE, so I prefer using <a href="http://en.wikipedia.org/wiki/Xcode" rel="nofollow">Xcode</a> for writing code. However, I have found all of the options available online for using Xcode to actually upload sketches to Arduino to be convoluted at best and have not been successful in trying to implement them.</p> <p>Current Method:</p> <p>What currently works well for me is to use Xcode strictly as a debugger, and 'creating' stripped down versions of Arduino classes when I need them so the debugger doesn't freak out when I put in lines of code specific to Arduino. For example, I have a Serial class in my Xcode project which has the following functions, which work just fine:</p> <pre><code>void Serial::print(int myInt) { cout &lt;&lt; myInt; } void Serial::println(int myInt) { cout &lt;&lt; myInt &lt;&lt; endl; } </code></pre> <p>I do the same for strings, and whatever other standard <a href="http://en.wikipedia.org/wiki/C++" rel="nofollow">C++</a> datatype I may need to print.</p> <p>This way, any time I want to put <code>Serial.print</code> within a function in another class I'm working on, I can debug strictly from within Xcode without opening the Arduino IDE. I can also create a "fake" class for <code>pinMode</code>, etc.</p> <p>Issue:</p> <p>I would like to do this with the <code>byte</code> datatype used in the Arduino environment. I am taking an object-oriented approach to this program, and it threatens to eat up the precious RAM on my little Arduino. So, in order to save space, I'm converting all my <code>int</code>s to <code>byte</code>s and so forth.</p> <p>But, I assume (and my compiler tells me) that I can't subclass <code>char</code>, or <code>int</code>, or any other basic types. I don't see how I can start using statements like "<code>byte a = 2</code>" or something similar with my current (somewhat convoluted) work-around method.</p> <p>Essentially, I want to trick Xcode into thinking <code>byte</code> is the same thing as <code>int</code> for all intents and purposes.</p> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload