forked from RobTillaart/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ renamed fastMapDemo
1 parent
67310e2
commit 520cd5c
Showing
2 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
libraries/fastMap/examples/constrainedMapDemo/constrainedMapDemo.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// FILE: constrainedMap.ino | ||
// AUTHOR: Rob Tillaart | ||
// VERSION: 0.1.00 | ||
// PURPOSE: | ||
// DATE: 2014-11-02 | ||
// URL: | ||
// | ||
// Released to the public domain | ||
// | ||
|
||
#include "fastMap.h" | ||
|
||
fastmap mapper; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.print("Start constrainedMap demo\nlib version: "); | ||
Serial.println(FASTMAP_LIB_VERSION); | ||
Serial.println(); | ||
|
||
mapper.init(0, 10, 0, 300); | ||
|
||
Serial.println("I\tMAP\tLCM\tUCM\tCM"); | ||
for (int i = -5; i < 20; i++) | ||
{ | ||
float a = map(i, 0, 10, 0, 300); | ||
float b = mapper.lowerConstrainedMap(i); | ||
float c = mapper.upperConstrainedMap(i); | ||
float d = mapper.constrainedMap(i); | ||
Serial.print(i); | ||
Serial.print("\t"); | ||
Serial.print(a); | ||
Serial.print("\t"); | ||
Serial.print(b); | ||
Serial.print("\t"); | ||
Serial.print(c); | ||
Serial.print("\t"); | ||
Serial.println(d); | ||
} | ||
Serial.println("\ndone..."); | ||
} | ||
|
||
void loop() | ||
{ | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters