grrrr, spit, growl, and stamp.
Moderators: adafruit_support_bill, adafruit
{
{
{
}
{
{
{
{
{
}
}
}
{
}
}
}
}{
serial.print("loop 1 start");
//code goes here
{
serial.print("loop 2 start");
//code goes here
{
serial.print("loop 3 start");
//code goes here
serial.print("loop 3 end");
}
{
serial.print("loop 4 start");
//code goes here
{
serial.print("loop 5 start");
//code goes here
{
serial.print("loop 6 start");
//code goes here
{
serial.print("loop 7 start");
//code goes here
{
serial.print("loop 8 start");
//code goes here
serial.print("loop 8 end");
}
serial.print("loop 7 end");
}
serial.print("loop 6 end");
}
{
serial.print("loop 9 start");
//code goes here
serial.print("loop 9 end");
}
serial.print("loop 5 end");
}
serial.print("loop 4 end");
}
serial.print("loop 2 end");
}
serial.print("loop 1 end");
}
// for printf
#include <stdio.h>
// global to store nest depth
static int nestDepth = 0 ;
// our pro/epilog debug routine
void _prolog( const char *funcName, const char*fileName, int lineNumber)
{
int i = nestDepth;
// use this for visual c++ clicking in console output window for going to a source code/line file, but makes the output less clear
// printf("%s(%d) : error C1000:\n",fileName,lineNumber);
// print out tabs for n nest level
while( i-- ) printf("\t");
printf("%s() {\n",funcName);
//increase nesting
nestDepth++;
}
void _epilog( const char *funcName, const char*fileName, int lineNumber)
{
int i;
// decrease depth
nestDepth--;
i = nestDepth;
// print out tabs for n nest level
while( i-- ) printf("\t");
printf("}\n");
}
#define PROLOG( f ) _prolog(f, __FILE__, __LINE__ )
#define EPILOG( f ) _epilog(f, __FILE__, __LINE__ )
// program code
void bar(void )
{
PROLOG("bar");
// do stuff
EPILOG("bar");
}
void foo(void )
{
PROLOG("foo");
bar();
EPILOG("foo");
}
int main()
{
PROLOG("main");
foo();
EPILOG("main");
}
main() {
foo() {
bar() {
}
}
}
// assuming a 16 bit int
#define GUARD_1 ( 0xDEAD)
#define GUARD_2 ( 0xF00D)
void *malloc( size_t size) {
int *temp;
// add some space for the guard bytes
size += sizeof(int * 2 ) ;
// allocate original space + two extra int's
temp = malloc( size ) ;
temp[0] = GUARD_1;
temp[size+2] = GUARD_2;
// skip the guard int
temp ++;
// pass back the memory the program should use
return (void *)temp;
}
when I tried to watch an LED pin going high or low, I didn't get the serial monitor print of HIGH /LOW... but the pin number! eg; serial.print(ledPin) came back with 0 or 45 (the pin number of ledPin)!
#define TRUE (1)
#define FALSE (0)
typedef Bool int;
Bool ret ;
ret = read_adc()?TRUE:FALSE;
Users browsing this forum: No registered users and 1 guest