<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: Library Hacking?</title>
		<link>http://forums.leaflabs.com/topic.php?id=555</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:19:43 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=555" rel="self" type="application/rss+xml" />

		<item>
			<title>gbulmer on "Library Hacking?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=555#post-3003</link>
			<pubDate>Mon, 06 Dec 2010 06:49:14 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">3003@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;DarkStar - there is an online book on C which will cover most of the Arduino/Maple programming language&#60;br /&#62;
&#60;a href=&#34;http://publications.gbdirect.co.uk/c_book/&#34; rel=&#34;nofollow&#34;&#62;http://publications.gbdirect.co.uk/c_book/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;The actual Arduino/Maple language is C++, but very few features of C++ are used, and it is easy to get lost or side tracked in C++, when trying to learn it, whereas C is much smaller, hence quicker to learn, and IMHO C is 90% of the programming most Arduino code uses. Learning C first, then adding the last 10% from C++ is, IMHO, easier and quicker than trying to learn C++, and then figure out what is not used.&#60;/p&#62;
&#60;p&#62;(NB I learned C before C++ existed, so I am biased. On the other hand, I have watched over 20 years of people struggling and often failing to write simple, clear, maintainable C++ :-)&#60;/p&#62;
&#60;p&#62;Those types of messages &#34;not expecting an X before/after Y&#34; usually indicate&#60;br /&#62;
- punctuation is incorrect, like missing or adding extra ',' ';' '(' ')' '{'  '}', or&#60;br /&#62;
- a reserved word of the language is misspelled, for example &#60;code&#62;whle (i&#38;lt;7) { ...&#60;/code&#62;&#60;br /&#62;
    the IDE helps here because the colour of the languages words is different to the names you introduce, or&#60;br /&#62;
- putting stuff in the wrong place&#60;/p&#62;
&#60;p&#62;If you can't see it, and the compiler error message isn't helping locate it, one approach is to 'comment out' chunks of code until it becomes clearer. 'Commenting out' means do something to stop the compiler looking at part of the code. When the chunk with the error in is commented out, the error message disappears. When this happens, you know which piece of code likely contains the error, or part of the error. So divide the aprt with the error into two by 'commenting out' half of it, and try again. It is practical to hunt errors to a single line quite quickly this way.&#60;/p&#62;
&#60;p&#62;For a quick approach I use /* and */ comment markers, but C comments don't nest (in the C standard), so I use the power of the C pre-processor. The C pre-processor manipulates the program source code before the C compiler proper scans it. The C pre-processor is like a command line text editor on steroids. All of it's commands are introduced by a line starting with a '#'. So for example the #include is handled by the pre-processor.&#60;/p&#62;
&#60;p&#62;The C pre-processor can remove program source text, so the C compiler never gets it, and this is one way to 'comment out' parts of a program.&#60;/p&#62;
&#60;p&#62;Use&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;#if 0
....
#endif&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;to 'comment out' code, and&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;#if 1
....
#endif&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;to switch that code back on&#60;/p&#62;
&#60;p&#62;I think it uses less editing while I am trying to hunt the error because I can leave all the #if and #endif in place, and fiddle with 0 and 1 to get different pieces excluded.&#60;/p&#62;
&#60;p&#62;In this case the error is near a '{' so the IDE can help.&#60;br /&#62;
When the cursor is on a '{' '}' '(' or ')' it will highlight the matching brace or parenthesis.&#60;/p&#62;
&#60;p&#62;Possibly the program has too many or not enough '{' or '}'
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DarkStar on "Library Hacking?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=555#post-2996</link>
			<pubDate>Sun, 05 Dec 2010 22:36:52 +0000</pubDate>
			<dc:creator>DarkStar</dc:creator>
			<guid isPermaLink="false">2996@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks crenn i tried what you said but it didnt work it gave me some error  &#34;error: a function-definition is not allowed here before '{' token&#34; there must be something else that the Maple IDE doesn't like im just not experienced enough to understand it. But i ordered some books so hopefully soon ill know much more. Thanks for the help.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "Library Hacking?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=555#post-2991</link>
			<pubDate>Sun, 05 Dec 2010 15:17:10 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">2991@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Unlike the Arduino, you need to tell the pin you're going to measure an analog signal. Also, on the Arduino Analog 0 is pin 15 on the maple.&#60;/p&#62;
&#60;p&#62;Put this in Setup:&#60;br /&#62;
pinMode(15, ANALOG);&#60;/p&#62;
&#60;p&#62;And when reading, use analogRead(15);
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DarkStar on "Library Hacking?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=555#post-2990</link>
			<pubDate>Sun, 05 Dec 2010 14:36:25 +0000</pubDate>
			<dc:creator>DarkStar</dc:creator>
			<guid isPermaLink="false">2990@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Awesome thanks snigelen i got it working right away!!! Now i have one more that is similar but also uses an analog pin connected to a pot but i cant seem to get it working. i have replaced what you have showed me so far so if you could let me know what needs to be changed with the code below it would be great,thanks. Also what do i need to learn to be able to right my own code is it c++? &#60;/p&#62;
&#60;p&#62;//Counts up to 5000 and back down to 0. Speed of counting is adjustable by a potentiometer.&#60;/p&#62;
&#60;p&#62;//Wiring is simple.&#60;/p&#62;
&#60;p&#62;//Digital pin 3 on arduino to RX on display.&#60;br /&#62;
//Ground pin on arduino to GND on display.&#60;br /&#62;
//5 volt pin on arduino to VCC on display&#60;/p&#62;
&#60;p&#62;//The pot is hooked up to analog input pin 0.&#60;br /&#62;
//If you don't know how to hook up a pot. Look for videos on youtube.&#60;/p&#62;
&#60;p&#62;// Use Serial1 for communication with the 7-seg module&#60;br /&#62;
// Connect Maple pin 7(tx1) to rx on the module&#60;/p&#62;
&#60;p&#62;#define mySerialPort Serial1&#60;/p&#62;
&#60;p&#62;const int analogPin = 0;   // the pin that the potentiometer is attached to&#60;/p&#62;
&#60;p&#62;void setup(){&#60;/p&#62;
&#60;p&#62;mySerialPort.begin(9600);&#60;/p&#62;
&#60;p&#62;/* send a &#34;v&#34; to the display. It's a special code to reset the display. See tutorial above for more info on special codes */&#60;br /&#62;
mySerialPort.print(&#34;v&#34;);&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;void loop(){&#60;/p&#62;
&#60;p&#62;for (int num = 0; num &#38;lt;= 5000; num++) { //simple for loop&#60;/p&#62;
&#60;p&#62;mySerialPort.print(&#34;v&#34;);&#60;br /&#62;
mySerialPort.print(num); //send value of num to display&#60;br /&#62;
delay(analogRead(0)); //delay by pot value&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;//same as above except for loop goes in pposite direction&#60;br /&#62;
for (int num = 5000; num &#38;gt;= 0; num--) {&#60;br /&#62;
mySerialPort.print(&#34;v&#34;);&#60;br /&#62;
mySerialPort.print(num);&#60;br /&#62;
delay(analogRead(0));&#60;br /&#62;
}
&#60;/p&#62;</description>
		</item>
		<item>
			<title>snigelen on "Library Hacking?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=555#post-2989</link>
			<pubDate>Sun, 05 Dec 2010 04:28:40 +0000</pubDate>
			<dc:creator>snigelen</dc:creator>
			<guid isPermaLink="false">2989@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;You don't have to change much to get it to work with, for example, Serial1 on the Maple.&#60;br /&#62;
Just remove&#60;/p&#62;
&#60;p&#62;&#60;code&#62;#include &#38;lt;NewSoftSerial.h&#38;gt;&#60;/code&#62;&#60;br /&#62;
and&#60;br /&#62;
&#60;code&#62;NewSoftSerial mySerialPort(SerInToArdu,SerOutFrmArdu);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Then put in these lines before setup&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;// Use Serial1 for communication with the 7-seg module
// Connect Maple pin 7(tx1) to rx on the module
#define mySerialPort Serial1&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;You can also remove the pinMode's from setup.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Library Hacking?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=555#post-2984</link>
			<pubDate>Sat, 04 Dec 2010 21:02:43 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">2984@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;DarkStar - Glerk! It's past 2am here, so I'll need some sleep before looking at that.&#60;/p&#62;
&#60;p&#62;Night!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DarkStar on "Library Hacking?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=555#post-2979</link>
			<pubDate>Sat, 04 Dec 2010 20:09:26 +0000</pubDate>
			<dc:creator>DarkStar</dc:creator>
			<guid isPermaLink="false">2979@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ok heres the code for the 7 segment LED display that im trying to learn with let me know what i need to change to make it work with the maple. Heres the tutorial link where i got the code. &#60;a href=&#34;http://www.arunet.co.uk/tkboyd/ec/ec1led4x7ser.htm&#34; rel=&#34;nofollow&#34;&#62;http://www.arunet.co.uk/tkboyd/ec/ec1led4x7ser.htm&#60;/a&#62;  &#60;/p&#62;
&#60;p&#62;//ArdD001&#60;br /&#62;
//ver 12 Aug 10&#60;/p&#62;
&#60;p&#62;//(Started 12 Aug 10, 277RR, 2nd day there.)&#60;/p&#62;
&#60;p&#62;//Created using version 0017 of the Arduino Development Environment&#60;/p&#62;
&#60;p&#62;//Very, very simple &#34;test&#34; program for Sparkfun&#60;br /&#62;
//4 character 7 segment LED displays, serially driven&#60;br /&#62;
//using just the &#34;Rx&#34; input on the module.&#60;br /&#62;
//See Sparkfun.com... product codes COM-09764 - COM-09767&#60;br /&#62;
//(differ only in color)&#60;/p&#62;
&#60;p&#62;//Connect one of the above modules to an Arduino with&#60;br /&#62;
//just 3 wires: 5v (Vcc) (or 3.3, if you are using a&#60;br /&#62;
//low voltage system. Module is good down to 2.6v)&#60;br /&#62;
//Also connect to &#34;GND&#34; (ground), and with a wire from&#60;br /&#62;
//the &#34;Rx&#34; pad of the module... the MODULE is receiving&#60;br /&#62;
//it's commands through this... to the pin you choose to&#60;br /&#62;
//TRANSMIT data out from the Arduino on.&#60;br /&#62;
//If you use D3, then nothing below needs a change.&#60;br /&#62;
//If you use a different pin, then change the....&#60;br /&#62;
//#define SerOutFrmArdu...&#60;br /&#62;
//line.&#60;/p&#62;
&#60;p&#62;//When you run the program, you should see the following,&#60;br /&#62;
//one after the other...&#60;br /&#62;
//1234&#60;br /&#62;
//2340&#60;br /&#62;
//3400&#60;br /&#62;
//4000&#60;br /&#62;
//0000&#60;br /&#62;
//----&#60;br /&#62;
//8888&#60;br /&#62;
//HELO&#60;/p&#62;
&#60;p&#62;//(That last is the best we can do for &#34;Hello World&#34; on&#60;br /&#62;
//a 4 character, 7 segment display)&#60;/p&#62;
&#60;p&#62;//... then there will be a brief period when all the&#60;br /&#62;
//LEDs are off, and then the display will repeat the&#60;br /&#62;
//above. All that happens over and over.&#60;/p&#62;
&#60;p&#62;//Simple! When you know how. I didn't, and it took a&#60;br /&#62;
//while to get everything right. I hope you come&#60;br /&#62;
//across this in time to save yourself the time I wasted.&#60;/p&#62;
&#60;p&#62;#include &#38;lt;NewSoftSerial.h&#38;gt;&#60;br /&#62;
//Yes, NEWSoftSerial...&#60;br /&#62;
//I don't think SoftwareSerial has the&#60;br /&#62;
//&#34;available()&#34; function, does it? Not&#60;br /&#62;
//needed here, but might as well stick&#60;br /&#62;
//to one library for all work with&#60;br /&#62;
//extra serial lines.&#60;/p&#62;
&#60;p&#62;#define SerInToArdu 2//no ; here. Not used in this demo,&#60;br /&#62;
//  but in defining mySerialPort, we to designate some pin&#60;br /&#62;
//  for the serial data into the Arduino&#60;br /&#62;
#define SerOutFrmArdu 3//no ; The pin that serial data&#60;br /&#62;
//  will go out from the Arduino on. Beware &#34;Rx&#34;/&#34;Tx&#34;&#60;br /&#62;
//  &#34;gotcha&#34;: The Arduino's &#34;Tx&#34; (transmit) will go to&#60;br /&#62;
//  the connected device's &#34;Rx&#34; (receive)&#60;/p&#62;
&#60;p&#62;#define wDelay 600//no ; here. Sets how long each &#34;message&#34; appears&#60;/p&#62;
&#60;p&#62;NewSoftSerial mySerialPort(SerInToArdu,SerOutFrmArdu);&#60;br /&#62;
//  The above creates the serial channel we will use.&#60;/p&#62;
&#60;p&#62;void setup(){&#60;/p&#62;
&#60;p&#62;pinMode(SerOutFrmArdu,OUTPUT);&#60;br /&#62;
pinMode(SerInToArdu,INPUT);//Not actually needed... put in&#60;br /&#62;
   //to be explicit as to data direction over serial lines&#60;/p&#62;
&#60;p&#62;mySerialPort.begin(9600);&#60;/p&#62;
&#60;p&#62;mySerialPort.print(&#34;v&#34;);To reset display module&#60;br /&#62;
//See next demo program for more details, and text&#60;br /&#62;
//in &#34;Special Codes&#34; section of....&#60;br /&#62;
//http://www.arunet.co.uk/tkboyd/ec/ec1led4x7ser.htm&#60;/p&#62;
&#60;p&#62;};//end &#34;setup()&#34;&#60;/p&#62;
&#60;p&#62;void loop(){&#60;br /&#62;
  mySerialPort.print(&#34;1234&#34;);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  mySerialPort.print(&#34;2340&#34;);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  mySerialPort.print(&#34;3400&#34;);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  mySerialPort.print(&#34;4000&#34;);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  mySerialPort.print(&#34;0000&#34;);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  mySerialPort.print(&#34;----&#34;);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  mySerialPort.print(&#34;8888&#34;);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  mySerialPort.print(&#34;HEL0&#34;);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  mySerialPort.print(&#34;xxxx&#34;);//Send an &#34;x&#34; to turn a digit off&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
  delay(wDelay);&#60;br /&#62;
};
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DarkStar on "Library Hacking?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=555#post-2977</link>
			<pubDate>Sat, 04 Dec 2010 19:41:58 +0000</pubDate>
			<dc:creator>DarkStar</dc:creator>
			<guid isPermaLink="false">2977@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks gbulmer, I decided to go with the maple instead of the arduino becuase it was advertised as arduino campatible and it had much better specs but I soon realized that the maple was slightly diffrent then the arduino wich is making it more difficult to learn. I would like to try and figure out the maple but if it becomes to difficult ill just order a arduino and use that until I understand microcontrollers a little more them come back to the maple. If I post the code for the 7 segment display I'm trying to learn with could you help me figure out the diffrences and them hopefully I can apply those diffrences to other project I have lined up. Thanks for all the help. Ill post my code when I get home.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Library Hacking?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=555#post-2976</link>
			<pubDate>Sat, 04 Dec 2010 19:05:23 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">2976@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;DarkStar - I'm not a LeafLabs staffer, so I'm nervous to make any recommendation.&#60;/p&#62;
&#60;p&#62;Let me say, the Arduino newsoftserial library (&#60;a href=&#34;http://arduiniana.org/libraries/newsoftserial/&#34; rel=&#34;nofollow&#34;&#62;http://arduiniana.org/libraries/newsoftserial/&#60;/a&#62;) emulates extra serial ports; it is implemented in software.&#60;br /&#62;
It is important for the Arduino, because the the Arduino only has one serial port, and it is tied to the USB port, so it can't be used for any other purpose.&#60;/p&#62;
&#60;p&#62;A Maple has thee hardware serial ports, and all three are available because the Maple uses USB to communicate with the host PC.&#60;br /&#62;
So you won't need a software serial port library for Maple until you've got a need for a fourth serial port.&#60;/p&#62;
&#60;p&#62;Some of the code in &#34;newsoftserial library&#34; is very specific to the Arduino's ATmega processor. So you'd need to work through a couple of sections of two hardware manuals to do a port of that ATmega library to the Maple's STM32F.&#60;/p&#62;
&#60;p&#62;It is doable, but quite a challenging place to start if this is your first experience of low-level microcontroller hardware. If you want to suggest things that you want to do with your Maple, maybe we can help you choose how to tackle them so that you get what you are looking for. If &#34;newsoftserial library&#34; is it, maybe we can help you divide it into bite-sized pieces.&#60;/p&#62;
&#60;p&#62;I don't feel I have answered your question properly.&#60;/p&#62;
&#60;p&#62;Why did you choose to learn using Maple instead of using an Arduino?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DarkStar on "Library Hacking?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=555#post-2974</link>
			<pubDate>Sat, 04 Dec 2010 16:53:26 +0000</pubDate>
			<dc:creator>DarkStar</dc:creator>
			<guid isPermaLink="false">2974@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I copied a sketch on a tutorial that requires a &#34;newsoftserial library&#34; so downloaded it and added it to the maple IDE library folder and when i import the library into the sketch i get a &#34;Error Compiling&#34;. Then i read the &#34;READ ME&#34; in the library folder and it says &#34;Many libraries still need to be ported from Arduino... grab the original source from the Arduino SVN repo and get hacking!&#34; How do i hack the library?? or should i just buy a Arduino Uno and stop trying to learn on the maple?? &#60;/p&#62;
&#60;p&#62;Heres the meassage when i get an &#34;error compiling&#34;&#60;/p&#62;
&#60;p&#62;Going to build using 'armcompiler' (ARM)&#60;br /&#62;
	Compiling core...&#60;br /&#62;
	Compiling libraries: NewSoftSerial&#60;/p&#62;
&#60;p&#62;C:\Users\KiMbErLy\Desktop\maple\maple-ide-0.0.8\libraries\NewSoftSerial\NewSoftSerial.cpp:37: fatal error: avr/interrupt.h: No such file or directory&#60;/p&#62;
&#60;p&#62;compilation terminated.&#60;/p&#62;
&#60;p&#62;Listing of all compiler output follows.&#60;br /&#62;
	Note: &#38;lt;BUILD&#38;gt; stands for the temporary build directory used to compile your sketch, which is:&#60;br /&#62;
		C:\Users\KiMbErLy\AppData\Local\Temp\build2271363435871161941.tmp&#60;/p&#62;
&#60;p&#62;	Also note that because of preprocessing, line numbers won't match up exactly.  We're working on a fix.&#60;br /&#62;
C:\Users\KiMbErLy\Desktop\maple\maple-ide-0.0.8\libraries\NewSoftSerial\NewSoftSerial.cpp:37: fatal error: avr/interrupt.h: No such file or directory&#60;br /&#62;
compilation terminated.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
