0% found this document useful (0 votes)
24 views

Ping Ultrasonic Range Finder

The Ping Ultrasonic Range Finder document notes that measured distances may jump to larger values when objects get very close, and that centimeters may be more accurate than inches. The Gameduino2 document provides code snippets that set the screen color, clear the screen, display text in the center, swap the visible and work-in-progress screens, set the point size and color, draw a point at a coordinate, play random sounds, and notes there are always two screen copies and the screen size.

Uploaded by

John
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Ping Ultrasonic Range Finder

The Ping Ultrasonic Range Finder document notes that measured distances may jump to larger values when objects get very close, and that centimeters may be more accurate than inches. The Gameduino2 document provides code snippets that set the screen color, clear the screen, display text in the center, swap the visible and work-in-progress screens, set the point size and color, draw a point at a coordinate, play random sounds, and notes there are always two screen copies and the screen size.

Uploaded by

John
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Ping Ultrasonic Range Finder:

Note: when something gets very close, sometimes the distance jumps very large.
Need to keep this in mind or will cause problems later. Centimeters may be more
accurate then inches.
Connection:

Gameduino2:
GD.ClearColorRGB(0x103000); //it sets the color used for screen clears
GD.Clear(); //It clears the screen to the dark green color. Drawing must always begin with a
clear screen.
GD.cmd_text(240, 136, 31, OPT_CENTER, "Hello world"); //(x,y,FontSize) 240,136 is center of
screen. 31 largest font and opt_center makes the center of the at the x,y.
GD.swap(); //drawing is finished and you can make it visible on screen.
GD.PointSize(16 * 30); // means 30 pixels
GD.Begin(POINTS); //allows for drawings to start.
GD.ColorA(128); // makes points 50% transparent
GD.ColorRGB(0xff8000); // orange and it adds color to the points

GD.Vertex2ii(260, 170); //pixel at (x,y)


GD.random(256);//picks a random number 0 -256
GD.play; // to play sounds

There are always two copies of the screen: one that is visible, and one that is work-inprogress.
Screen size: 480 pixels wide and 272 high. 0,0 is top-left

You might also like