PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Badge
01 Display
09 Plot Parabola.c
1
/*
2
Plot Parabola.c
3
Plot y = x^2 / 256 the from 0 to 127.
4
*/
5
6
#include "
simpletools.h
"
// Include simpletools library
7
#include "
badgetools.h
"
// Include badgetools library
8
9
int
x
, y;
10
11
void
main
()
// Main function
12
{
13
badge_setup
();
// Call badge setup
14
while
(1)
// Main loop
15
{
16
for
(
x
= 0;
x
< 128;
x
++)
// Count 0 to 127
17
{
18
y = 64 - (
x
*
x
/256);
// Calculate y
19
point
(
x
, y, 1);
// Plot white point
20
pause
(2);
// Wait 2 ms
21
}
22
pause
(500);
// Wait 5 s
23
for
(
x
= 127;
x
> 0;
x
--)
// Count 127 to 0
24
{
25
y = 64 - (
x
*
x
/256);
// Calculate y
26
point
(
x
, y, 0);
// Plot black point
27
pause
(2);
// Wait 2 ms
28
}
29
}
30
}
point
void point(int x, int y, int color)
Plot a point on the oLED screen.
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
main
int main(void)
Definition:
GraphicsTest.c:20
badge_setup
int badge_setup(void)
Set up all available badge drivers. Call this function at the start of any given program to allow acc...
Definition:
badgealpha.c:29
x
int x
Definition:
07 Box and Lines.c:13
badgetools.h
This library provides convenient functions for a variety of Parallax eBadge operations.
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17