Don't ad-block us - support your favorite websites. We have safe, unobstrusive, robotics related ads that you actually want to see - see here for more.
0 Members and 1 Guest are viewing this topic.
#include "sys/atmega328P.h" //These are the includes required by the webbotlib library.#include "a2d.h"#include "iopin.h"//#include "uart.h"#include "rprintf.h"#include "Displays/Generic/HD44780.h"// Forward referenceMAKE_WRITER(display_put_char);// Define the display for the AxonHD44780 display = MAKE_HD44780_4PIN(16,2,D0,D1,D2,D3,D4,D5,D6,&display_put_char);// Create a Writer to write to displayMAKE_WRITER(display_put_char){ return displaySendByte(&display,byte);}void appInitHardware(void) // In my initialising code{ pin_make_output(B0,FALSE); displayInit(&display); pin_low(B0); setErrorLog(displayGetWriter(&display)); rprintfInit(displayGetWriter(&display));}TICK_COUNT appInitSoftware(TICK_COUNT loopStart)//This is the main loop that provides timing by delaying by 1 cycle{ displayAutoScroll(&display,FALSE); displayLineWrap(&display,FALSE); int cols = MIN(NUM_ADC_CHANNELS, displayColumns(&display)); for(int n=0; n<cols;n++){ rprintf("%d",n % 10); } return 0;} TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) { int depth = displayLines(&display)-1; int cols = MIN(NUM_ADC_CHANNELS, displayColumns(&display)); for(int ch = 0; ch<cols; ch++){ uint8_t val = a2dConvert8bit(ADC_NUMBER_TO_CHANNEL(ch)); displayVertGraph(&display,ch,1, val, 255, depth); } return 10;}
I assume that the LED flickering means the microcontroller is constantly resetting.
I have commented out all display related things (except the init) and it still does it...