Arduino PING!

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
tapijtklopper
 
Posts: 14
Joined: Sat Jun 16, 2012 10:18 am

Arduino PING!

Post by tapijtklopper »

Hello, this is my first post on this forum so please forgive (some of) my ignorance. :?

I've been using the Arduino UNO R2 for about two weeks now, it's awesome.
I want to make this: http://www.niklasroy.com/project/101/PING
I have all the parts, the only last hurdle is that i want to use the Arduino as an ISP to program this : http://niklasroy.com/codes/ping.txt onto an Atmega8-16PU.
It's probably very easy, but i've been searching for days now and can't seem to find it. Every answer brings more questions.
All i can find are tutorials on howto burn the Arduino bootloader and then add Arduino code to it.

So can anyone give me a step by step tutorial on how to do this?

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: Arduino PING!

Post by Franklin97355 »


User avatar
tapijtklopper
 
Posts: 14
Joined: Sat Jun 16, 2012 10:18 am

Re: Arduino PING!

Post by tapijtklopper »

Yes, but isn't that just to burn the Arduino bootloader?
I also found this: http://arduino.cc/en/Tutorial/ArduinoToBreadboard

But from what i can understand both are meant for Arduino programming or migration.
I need to program C code onto the Atmega8. Which method is the correct one?
Also, is the Atmega8-16PU a raw chip? Does it need another kind of bootloader?

User avatar
tapijtklopper
 
Posts: 14
Joined: Sat Jun 16, 2012 10:18 am

Re: Arduino PING!

Post by tapijtklopper »

I've tried to use the c code on Arduino 1.0.1
I copy/paste it and click Verify but it give me the following messages.

sketch_jun17a.cpp: In function 'int main()':
sketch_jun17a:92: error: 'GICR' was not declared in this scope

Any idea on what's wrong.

Code: Select all

/*
 PING runs on an ATMEGA8 with 16MHz, program is written in AVR-GCC

* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <niklasroy.com> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return Niklas Roy
* ----------------------------------------------------------------------------

 As usual:
 Sorry for too less coments and crappy coding skills

*/


#include <avr/io.h>
#include <stdint.h>
#include <stdlib.h>
#include <util/delay.h>
#include <math.h>
#include <avr/interrupt.h>


volatile uint8_t ping_graphics[8][19]={

		{1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,1,0,1,0},
		{1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,1,0},
		{1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0},
		{1,1,1,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,0},
		{1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0},
		{1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0},
		{1,0,0,0,0,1,0,1,0,0,1,0,1,1,1,1,0,1,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
   };

volatile uint8_t subtext_graphics[6][72]={
	// 	   A         U         G         M           E         N         T           E         D             P         I   X         E         L
		{0,1,1,1,1,0,1,0,0,1,0,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,0,1,1,1,1,0,1,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,0},
		{0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0},
		{0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,1,0,0,1,0,0,1,0,0,0,1,0,0,0,1,1,1,0,0,1,0,0,1,0,0,0,1,1,1,1,0,1,0,0,1,1,0,0,1,1,1,0,0,1,0,0,0,0},
		{0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0},
		{0,1,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,0,0,1,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,1,1,1,0,1,1,1,1,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
	//   1                 1                   2                   3                   4                   5                   6                   7
	//                     0                   0                   0                   0                   0                   0                   0
	//   |                 |                   |                   |                   |                   |                   |                   |                   |
   };

float slow_count=0;
float sin_result;
float sin_result2;
volatile uint8_t sin_shift=0;
volatile uint8_t scroll_count;
volatile uint16_t video_line=0;
volatile uint8_t ball_x=20; //0-110
volatile uint16_t ball_y=100; //50-290
volatile int8_t speed_x=1;
volatile int8_t speed_y=2;
volatile uint8_t obstacle[]={0,0,0,0,0,0,0,0};
volatile uint8_t end_of_image=0;
volatile uint8_t display_thresh=0;
volatile uint8_t start_screen=1;

int8_t ball_direction;
int8_t beep_cycle=0;;


//////////////////////////////////////////////////////////////// MAIN /////////////////////////////



int main(void)
{

	//IO
    DDRB = 0b00000010;  					// b1:sound output
	DDRC = 0b00000001;  					// c0:via 1k to video signal
	DDRD = 0b00000000;  					// d2,d3 sync signal inputs


	//Pull Up's / Outputs
	PORTB= 0b00000000; 						//
	PORTC= 0b00000000; 						//
	PORTD= 0b00100000;						// d5:button

	TCCR1A=0b01000000;						// configure pwm output on pb1 (sound)
	TCCR1B=0b00001011;


	MCUCR=0b00000110;						//INT0 & INT1 generate interrupt requests
	GICR= 0b11000000;						//hardware interrupt INT0&1 enable
 	sei();									//switch on global interrupts

	while(1)
	{
		if (end_of_image){					//will be executed when whole image is drawn
			end_of_image=0;

			if ( PIND & (1<<5 ) ) {			//check button
	  			display_thresh=0; 			//no button pushed
			}else{
	  			display_thresh++; 			//button pushed
				if (display_thresh>25)display_thresh=25;
				start_screen=0;

				TCCR1A=0b10000001;						// configure pwm output on pb1 (sound)
		        TCCR1B=0b00000010;
			}

			if(start_screen){				//calculate start screen animation

					scroll_count++;
					slow_count++;
					sin_result=slow_count;
					sin_result/=16;
					sin_result=sin(sin_result);
					sin_result+=1;
					sin_result*=60;


					sin_result2=slow_count*10;
					sin_result2=sin(sin_result2);
					sin_result2+=1;
					sin_result2*=5;

					sin_shift=sin_result;

					OCR1A=(sin_result+sin_result2)*8+20;   //sound at start animation
					TCNT1=0;

			}else{						    //no start screen: calculate game logics instead

				uint8_t max_val=0;
				uint8_t max_pos=10;

				for (uint8_t i=0;i<8;i++){	//find darkest obstacle
					if(obstacle[i]>max_val){
						max_val=obstacle[i];
						max_pos=i;
					}
				}


				OCR1A=OCR1A>>1;	  			//switch off previous sound


				switch (max_pos){ //new direction is opposite from darkest obstacle
					case 4:
						speed_x=-1;
						speed_y=-2;
						OCR1A=21; //sound
					break;
					case 5:
						speed_x=0;
						speed_y=-2;
						OCR1A=22; //sound
					break;
					case 6:
						speed_x=1;
						speed_y=-2;
						OCR1A=23; //sound
					break;
					case 7:
						speed_x=1;
						speed_y=0;
						OCR1A=24; //sound
					break;
					case 0:
						speed_x=1;
						speed_y=2;
						OCR1A=25; //sound
					break;
					case 1:
						speed_x=0;
						speed_y=2;
						OCR1A=26; //sound
					break;
					case 2:
						speed_x=-1;
						speed_y=2;
						OCR1A=27; //sound
					break;
					case 3:
						speed_x=-1;
						speed_y=0;
						OCR1A=28; //sound
					break;
				}

				//move ball
				ball_x+=speed_x;

				if (ball_x==255){		//ball out left
					ball_x=93;
				}else if(ball_x>93){	//ball out right
					ball_x=0;
					}

				ball_y+=speed_y;

				if (ball_y>275)	{		//bounce bottom
					speed_y=-2;
					ball_y=275;
					OCR1A=33; 			//sound
					}

				if (ball_y<65)	{		//bounce top
					speed_y=2;
					ball_y=65;
					OCR1A=33;			//sound
					}


				for (uint8_t i=0;i<8;i++){		//reset obstacle detection
					obstacle[i]=0;
				}
			}
		}
	}
}


ISR(INT1_vect) 								// interrupt routine - new video image
{
video_line=0;
}


ISR(INT0_vect) 								// interrupt routine - new video line
{
	video_line++;
	uint16_t temp_video_line=video_line;
	uint8_t temp_ball_x=ball_x;
	uint16_t temp_ball_y=ball_y;
	uint8_t temp_top_left_obstacle=obstacle[0];
	uint8_t temp_top_mid_obstacle=obstacle[1];
	uint8_t temp_top_right_obstacle=obstacle[2];
	uint8_t temp_right_obstacle=obstacle[3];
	uint8_t temp_bot_right_obstacle=obstacle[4];
	uint8_t temp_bot_mid_obstacle=obstacle[5];
	uint8_t temp_bot_left_obstacle=obstacle[6];
	uint8_t temp_left_obstacle=obstacle[7];
	uint8_t i;


	if (start_screen){//------------------------------------------------ start screen

		if (temp_video_line>=45&&temp_video_line<230){
			_delay_us(16);
			uint8_t screen_y=(temp_video_line-45-sin_shift)/8;
			if (screen_y>7)screen_y=7;
			for (uint8_t i=0;i<19;i++){
				PORTC=ping_graphics[screen_y][i]; 		//draw 'PING'
			}
		}else if (temp_video_line>230&&temp_video_line<260){
			_delay_us(2);
			uint8_t screen_y=(temp_video_line-230)/4;
			if (screen_y>5)screen_y=5;
			for (uint8_t i=0;i<50;i++){
				PORTC=subtext_graphics[screen_y][i]; 	//draw 'AUGMENTED'
			}
		}else if (temp_video_line>260&&temp_video_line<290){
			_delay_us(2);
			uint8_t screen_y=(temp_video_line-260)/4;
			if (screen_y>5)screen_y=5;
			_delay_us(12.5);
			for (uint8_t i=50;i<72;i++){
				PORTC=subtext_graphics[screen_y][i];	//draw 'PIXEL'
			}
		}else if (temp_video_line==290){
			end_of_image=1;
		}
	}else{//------------------------------------------------------------ normal_game
		if(temp_video_line>60&&temp_video_line<290){

			if(temp_video_line<65){			//top playfield line
				_delay_us(4.5);
				PORTC=0b00000001;
				_delay_us(41);
				_delay_us(.5);
				PORTC= 0b00000000;
			}else if(temp_video_line>285){	//bottom playfield line
				_delay_us(4);
				PORTC=0b00000001;
				_delay_us(41);
				_delay_us(.5);
				PORTC= 0b00000000;
			}else if(display_thresh>24){		//display brightnes threshold for adjustment
				_delay_us(2);
				for (i=0;i<74;i++){
					if ((ACSR&(1<<ACO ))){
						PORTC=0b00000001;
						}
						_delay_us(.1);
						PORTC= 0b00000000;

					}
					PORTC=0b00000000;
			}else if (temp_video_line>temp_ball_y-5&&temp_video_line<temp_ball_y+15){//draw ball and capture brightnes of surrounding area

				if (temp_video_line<temp_ball_y){ 									//capture video lines on top of ball
				 	_delay_us(1.2);
				 	for (i=0;i<temp_ball_x;i++)_delay_us(.1);
					PORTC=0b00000010;_delay_us(.1);PORTB= 0b00000000;
					if ((ACSR&(1<<ACO )))temp_top_left_obstacle+=2;					//capture brightnes top left of ball
					if ((ACSR&(1<<ACO )))temp_top_left_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_left_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_left_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_left_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_left_obstacle+=2;

					_delay_us(.1);
					if ((ACSR&(1<<ACO )))temp_top_mid_obstacle+=2;					//capture brightnes top of ball
					if ((ACSR&(1<<ACO )))temp_top_mid_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_mid_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_mid_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_mid_obstacle+=2;

					_delay_us(.1);
					if ((ACSR&(1<<ACO )))temp_top_right_obstacle+=2;				//capture brightnes top right of ball
					if ((ACSR&(1<<ACO )))temp_top_right_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_right_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_right_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_right_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_top_right_obstacle+=2;
				 }

				 if (temp_video_line>temp_ball_y&&temp_video_line<temp_ball_y+10){ 	//ball video lines
				 	_delay_us(.8);
				 	for (i=0;i<temp_ball_x;i++)_delay_us(.1);
					 PORTC=0b00000010;_delay_us(.1);PORTB= 0b00000000;

					 if ((ACSR&(1<<ACO )))temp_left_obstacle++;						//capture brightnes left of ball
					 PORTC=0b00000001;												//draw ball
					 if ((ACSR&(1<<ACO )))temp_left_obstacle++;
					 if ((ACSR&(1<<ACO )))temp_left_obstacle++;
					 if ((ACSR&(1<<ACO )))temp_left_obstacle++;
					 if ((ACSR&(1<<ACO )))temp_left_obstacle++;
					 if ((ACSR&(1<<ACO )))temp_left_obstacle++;

					 _delay_us(.5);

					 if ((ACSR&(1<<ACO )))temp_right_obstacle++; 					//capture brightnes right of ball
					 PORTC= 0b00000000;												//no ball anymore
					 if ((ACSR&(1<<ACO )))temp_right_obstacle++;
					 if ((ACSR&(1<<ACO )))temp_right_obstacle++;
					 if ((ACSR&(1<<ACO )))temp_right_obstacle++;
					 if ((ACSR&(1<<ACO )))temp_right_obstacle++;
					 if ((ACSR&(1<<ACO )))temp_right_obstacle++;
					}

				 if (temp_video_line>temp_ball_y+10){ 								//video lines below ball
				 	for (i=0;i<temp_ball_x;i++)_delay_us(.1);
				 	PORTC=0b00000010;_delay_us(.1);PORTC= 0b00000000;
					if ((ACSR&(1<<ACO )))temp_bot_left_obstacle+=2;					//capture brightnes top left of ball
					if ((ACSR&(1<<ACO )))temp_bot_left_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_left_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_left_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_left_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_left_obstacle+=2;

					_delay_us(.1);
					if ((ACSR&(1<<ACO )))temp_bot_mid_obstacle+=2;					//capture brightnes top of ball
					if ((ACSR&(1<<ACO )))temp_bot_mid_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_mid_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_mid_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_mid_obstacle+=2;

					_delay_us(.1);
					if ((ACSR&(1<<ACO )))temp_bot_right_obstacle+=2;					//capture brightnes top right of ball
					if ((ACSR&(1<<ACO )))temp_bot_right_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_right_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_right_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_right_obstacle+=2;
					if ((ACSR&(1<<ACO )))temp_bot_right_obstacle+=2;
				 }
			}
		}else if(temp_video_line==290){end_of_image=1;}
	}

	//update volatiles
	obstacle[0]=temp_top_left_obstacle;
	obstacle[1]=temp_top_mid_obstacle;
	obstacle[2]=temp_top_right_obstacle;
	obstacle[3]=temp_right_obstacle;
	obstacle[4]=temp_bot_right_obstacle;
	obstacle[5]=temp_bot_mid_obstacle;
	obstacle[6]=temp_bot_left_obstacle;
	obstacle[7]=temp_left_obstacle;
}






User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: Arduino PING!

Post by Franklin97355 »

Where is GICR defined? Probably in one of the includes but are you sure?

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: Arduino PING!

Post by mtbf0 »

looks like you're not compiling for the right chip. GICR is a register on the mega8. if you had the correct board type selected it should compile. on my arduino 1.01 arduino ng with atmega8 is the very last board in the list. try that.

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: Arduino PING!

Post by mtbf0 »

aw, shoot. someone really ought to filter my posts for stupid...

you've got other problems.

arduino defines its own main routine. you'll have to put your code into loop(). i believe that arduino also supplies isr's for int0 and int1, so you'll have to use attachInterrupt() in order to get your code linked to those routines. consult the arduino reference for how that works.

best idea, though, is to not use arduino at all and compile with avr-gcc since that's what the program is written for.

you can still use arduinoisp to upload to your project. you'll need to locate the correct fuse settings, or you'll find that your project is running at about 1MHz instead of 16MHz. the information you need may be on the page on which you found the project. maybe there's a Makefile as well.

User avatar
tapijtklopper
 
Posts: 14
Joined: Sat Jun 16, 2012 10:18 am

Re: Arduino PING!

Post by tapijtklopper »

Thanks for the reply.
This is turning out to be a lot harder than i imagined, a lot of technical jargon that i'm trying to learn, not giving up though.

So please excuse me for still trying with the Arduino. Could i just opload the Arduino ISP to my Arduino board and then select in the Board menu "Arduino NG or older w/ ATmega8" as the chip to program?
Like this picture shows: http://arduino.cc/en/uploads/Tutorial/arduinoispNG.png
Wouldn't that give me the correct fuse settings?

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: Arduino PING!

Post by mtbf0 »

Tapijtklopper wrote:So please excuse me for still trying with the Arduino. Could i just opload the Arduino ISP to my Arduino board and then select in the Board menu "Arduino NG or older w/ ATmega8" as the chip to program?
not without rewriting the code. it's not an arduino sketch. arduino supplies it's own main function, so you can't have main in your code. arduino requires functions called setup and loop, neither of which are defined in the code you've provided. arduino provides isrs for int0 and int1, so there may be a conflict with your code. could be a world of other problems, too. i took only a cursory look.

your best bet will be to compile the code with avr-gcc and upload using arduino-isp and avrdude. i didn't see a Makefile on the page you linked to, but maybe i just missed it.

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: Arduino PING!

Post by mtbf0 »

Tapijtklopper wrote:So please excuse me for still trying with the Arduino. Could i just opload the Arduino ISP to my Arduino board and then select in the Board menu "Arduino NG or older w/ ATmega8" as the chip to program?
not without rewriting the code. it's not an arduino sketch. arduino supplies it's own main function, so you can't have main in your code. arduino requires functions called setup and loop, neither of which are defined in the code you've provided. arduino provides isrs for int0 and int1, so there may be a conflict with your code. could be a world of other problems, too. i took only a cursory look.

your best bet will be to compile the code with avr-gcc and upload using ArduinoISP and avrdude. i didn't see a Makefile on the page you linked to, but maybe i just missed it.

the fuse settings are shown in one of the photos on the project page. high fuse = 0xdf and low fuse = 0xef. again, it is probably simplest to use ArduinoISP and avrdude.

User avatar
tapijtklopper
 
Posts: 14
Joined: Sat Jun 16, 2012 10:18 am

Re: Arduino PING!

Post by tapijtklopper »

This is just a world of hurt man, i've been reading books of text to get this done. So far i've managed to opened the ping.txt file in Programmer's Notepad. I've told it it's C code and then i go to Tools and click WinAVR Make All. All it does is give me this error message.
( > "make.exe" all make.exe *** No rule to make
target `all'. Stop > Process Exit Code: 2 > Time taken: 00:08)

I can't figure out how to compile this. Let alone upload this to the Atmega8.
Can anyone prep the files for me and just give me a step by step tutorial?

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: Arduino PING!

Post by mtbf0 »

you need a Makefile. apparently winavr uses a program called MFile to generate makefiles. give it a try.

User avatar
tapijtklopper
 
Posts: 14
Joined: Sat Jun 16, 2012 10:18 am

Re: Arduino PING!

Post by tapijtklopper »

So i asked and got a .hex file from the guy who programmed it. Sadly no makefile.
But i think i can do this without a makefile. (or am i spacing on this one?)
And i think i finally know the rundown.
Here we go:

Flash the Arduino UNO with the ArduinoISP sketch on it.

Make a folder with the ping.hex file in it and a ping.bat with the following in it
avrdude -c arduino -p m8 -P usb -U flash:w:ping.hex

Connect the Arduino UNO to the Atmega8-16PU you need to program like this: http://arduino.cc/en/uploads/Tutorial/BreadboardAVR.png
Connect the Arduino UNO to the usb port and doubleclick the ping.bat file and it should start up avrdude and execute everything within a few seconds.

Is this the correct approach?

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: Arduino PING!

Post by mtbf0 »

more like :

Code: Select all

avrdude -c avrisp -p m8 -P COMwhatever -U flash:w:ping.hex
where COMwhatever is whichever COM port your arduino show up as.

if you have not yet burned your fuses, you will likely be disappointed since the mega8 will be running at 1 MHz.

Code: Select all

avrdude -c avrisp -p m8 -P COMwhatever -U hfuse:w:0xdf:m -U lfuse:w:0xef:m
these are the values i got from the project page you referenced. you might want to locate a fuse calculator and do a little sanity check before burning them because getting them wrong can effectively brick your chip.

have a look at ladyada's avr programming tutorial.

User avatar
tapijtklopper
 
Posts: 14
Joined: Sat Jun 16, 2012 10:18 am

Re: Arduino PING!

Post by tapijtklopper »

Ok, so by using this i got the same results.
[url]http://www.frank-zha%20o.com/fusecalc/fusecalc.php?chip=atmega8&LOW=EF&HIGH=DF&LOCKBIT=FF[/url]

So i need to run this first

Code: Select all

avrdude -c avrisp -p m8 -U hfuse:w:0xdf:m -U lfuse:w:0xef:m
(Adafruit says when using USB no -P is needed)

And then use

Code: Select all

avrdude -c avrisp -p m8 -P COMwhatever -U flash:w:ping.hex
Right?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”