Click this for NoviceGuard main page
You do not need the NovGrdCore Arduino library to use the NoviceGuard based examples and challenges on the web designed to help people use Arduinos.
If you've not yet heard about the NovGrdCore library, I would commend it to you. But it is your choice... use or not. (Use of the NoviceGuard itself is also optional, by the way.)
The rest of this page is about the simple things you have to provide to your users, if you want to use the examples and challenges.
Not every project will require every one of the things provided by NovGrdCore, but it won't matter if you do provide all of them.
Besides the NovGrdCore Arduino library, a NoviceGuard... a simple PCB with a few switches, resistors, jumpers, sockets... would be useful. But you do not need this either. A similar "How you do without the NoviceGuard hardware" page has also been set up for you.
You don't have to use the NoviceGuard hardware (a small PCB, which, with components, would cost about $25) to use the teaching notes, the programming lessons, the project ideas.
And, even if you use the NoviceGuard hardware, you don't have to use the NovGrdCore library.
I've written elsewhere about the pros and cons and alternatives to using the NoviceGuard hardware.
This page is about the pros and cons and alternatives to the NovGrdCore library.
One of the advantages of using the library is that it gives you (relatively!) easy way to refer to the different Arduino pins used in the NoviceGuard system. (I'll expand upon the names chosen in a moment.) They are...
#define inPUL 2 //no ; here #define inPUR 3 //no ; here ANALOG channel number #define inPLL 3 //no ; here #define inPLR 2 //no ; here ANALOG channel number
#define ouPUL 4 //no ; here #define ouPUR 13 //no ; here #define ouPLL 5 //no ; here #define ouPLR 12 //no ; here
The names are made up as follows: "in" or "ou" for INput or OUtput. One of the restrictions of using NoviceGuard is that a given pin is always used for one or the other in every project.
"P" in every case for "Pin".
UL, UR, LL, LR: The pushbuttons connected to the inputs and the LEDs connected to the outputs are both arranged in a square. (Through the "daughter boards", other inputs and outputs can be used, but even they will be arranged more or less as the switches and LEDs.) UL is for Upper Left. UR: Upper Right. LL: Lower Left. LR: Lower Right.
(Numbers are sometimes used to specify an input or output. They are 0,1,2,3 for, respectively, UL, UR, LL, LR. In other words, the numbers are assigned in the order you would read four words written as a square.)
As the upper left input is always on D2, you could just use "2" instead of inPUL... but using a mnemonic is a good habit for the beginners to get used to. In later work, they may well put something together which draws on someone else's ideas, but allocates inputs and outputs to different pins than were used in the original.
Whether you use a NoviceGuard board or not, with or without the NovGrdCore library, you must respect the NoviceGuard restrictions on the use of the pinMode command to get the advantages of the NoviceGuard environment.
There are two ways to do this.
If you/ your learners use the NovGrdCore library, they need only remember not to put any pinMode statements into their programs. The necessary pinMode statements will be done when an instance of the NovGrdCore class is incorporated into their program. (How To Do That covered in a moment.) They will never, until they progress beyond NoviceGuard, need to see a pinMode statement. That can be a pro or a con, depending on your point of view. I see it as a "pro"... Beginners have enough to master in their first hours. Postponing something, anything, where possible seems good to me.
If you are not using the NovGrdCore library, the following need to be in the setup() routine. These and no others. (Details of some of the whys and wherefores are visible in NovGrdCore.cpp, which is just a text file.)
pinMode(inPUL,INPUT_PULLUP); pinMode(inPLL,INPUT_PULLUP); pinMode(ouPUL,OUTPUT); pinMode(ouPUR,OUTPUT); pinMode(ouPLL,OUTPUT); pinMode(ouPLR,OUTPUT);
Yes... I know: we have not done pinMode statements for two of the pins. Their default states are satisfactory.
When you #include NovGrdLib, you get access to the following. All but the first can be done other ways, which I will explain. (The first supplies a want that doesn't arise if you aren't using a library)
If you call this, the version ID of the library will be sent to the serial monitor. You need to have executed a Serial.begin(9600) before you call reportVers().
If you execute makeOuUL(0), you will make the output driving the LED at the -U-pper-L-eft corner of the board low. Execute makeOuUL(1) and you make the output high. (In fact, any non-zero value for bState will make the output high.)
makeOuUL is complemented by makeOuUR, makeOuLL and makeOuLR, each of which allows you to make a different output high or low. One a NoviceGuardBoard with the default minimal components, and with links in the default settings, making an output high will turn an LED on.
There's another way to change the state of an output: You cal call makeOU(a,b). The first parameter determines which of the four outputs will be made high or low. The second parameter determines which state the output will be made.
boInHigh is a function which returns a boolean. You put 0, 1, 2 or 3 in as the parameter, and boInHigh will tell you, respectively, if the UpperLeft, UR, LL or LR input is currently high. In a basic NoviceGuard, the input will be high only if the button (switch) is not pressed.
The following is all you need in the loop of a program to test a basic NoviceGuard's four switches, four LEDs...
if (boInHigh(0)) {makeOu(0,0);} else {makeOu(0,1);}; if (boInHigh(1)) {makeOu(1,0);} else {makeOu(1,1);}; if (boInHigh(2)) {makeOu(2,0);} else {makeOu(2,1);}; if (boInHigh(3)) {makeOu(3,0);} else {makeOu(3,1);};
That's all the more remarkable when you remember that half of the inputs are connected to digital inputs, half to analog inputs... not a "fine point" I would trouble novices who are just getting started! But one they can learn about when they are ready, using NoviceGuard.
Digression Ends.... returning to Library Summary ---
These are the constructor and destructor code for the NovGrdCore class object. The destructor does nothing, but it exists, as an empty shell, in case a use arises.
The constructor does the pinMode statements that are essential for the proper operation of a NoviceGuard. Those pinMode statements can, of course, be done by hand... but why trouble your novices? Using the library, and seeing that the constructor is executed means your learners never even see a pinMode command, and thus may be less tempted to fiddle with one. (Details elsewhere.)
What you have been reading is about whether or not you "need" the free Arduino library "NovGrdCore"... and what you have to supply if you decide not to use the library.
I hope you will use the library, so that tutorials from multiple sources about ways to use NoviceGuard can be somewhat consistent. Their is another page, more "central" "all about NovGrdCore" which I hope you will find useful.
I hope that helped you understand what NoviceGuard has to offer? Click here for the main page for NoviceGuard if you haven't already seen it (or if, as I hope, you want to go back to it!)
I have many other ideas and resources for you out of my main page, SheepdogSoftware.co.uk.
Page has been tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes, just a few "No attribute" issues, arising from Google code.
....... P a g e . . . E n d s .....