Pretty printed the Arduino code with astyle
This commit is contained in:
@@ -5,29 +5,28 @@
|
||||
Seeed_Digital_Tube tube1;
|
||||
Seeed_Digital_Tube tube2;
|
||||
|
||||
/**
|
||||
* NOTICE:Every tubes display has the same default i2c address.
|
||||
* if you want to combine two(or more)display in one project,you should change the
|
||||
* i2c address,by soldering the pad of device's backside.
|
||||
* please refer to our wiki to get more details.
|
||||
/**
|
||||
NOTICE:Every tubes display has the same default i2c address.
|
||||
if you want to combine two(or more)display in one project,you should change the
|
||||
i2c address,by soldering the pad of device's backside.
|
||||
please refer to our wiki to get more details.
|
||||
* */
|
||||
#define I2C_ADDR_AFTER_CHANGE_FOUR 0x75
|
||||
#define I2C_ADDR_DEFAULT_FOUR 0x71
|
||||
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
Wire.begin();
|
||||
|
||||
// If using four digital tubes, use this configuration.
|
||||
tube1.setTubeType(TYPE_4,I2C_ADDR_AFTER_CHANGE_FOUR);
|
||||
tube1.setTubeType(TYPE_4, I2C_ADDR_AFTER_CHANGE_FOUR);
|
||||
|
||||
tube1.setBrightness(15);
|
||||
tube1.setBlinkRate(BLINK_OFF);
|
||||
|
||||
// If using four digital tubes, use this configuration.
|
||||
tube2.setTubeType(TYPE_4,I2C_ADDR_DEFAULT_FOUR);
|
||||
tube2.setTubeType(TYPE_4, I2C_ADDR_DEFAULT_FOUR);
|
||||
|
||||
tube2.setBrightness(15);
|
||||
tube2.setBlinkRate(BLINK_OFF);
|
||||
@@ -35,15 +34,14 @@ void setup()
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
void loop() {
|
||||
tube1.displayNum(1234);
|
||||
delay(100);
|
||||
|
||||
tube2.displayNum(5678);
|
||||
delay(100);
|
||||
|
||||
while(1);
|
||||
while (1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,68 +1,66 @@
|
||||
/*
|
||||
* display_basic.ino
|
||||
* Example for digital tube.
|
||||
*
|
||||
* Copyright (c) 2018 Seeed Technology Co., Ltd.
|
||||
* Website : www.seeed.cc
|
||||
* Author : downey
|
||||
* Create Time: sep. 2018
|
||||
* Change Log :
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
display_basic.ino
|
||||
Example for digital tube.
|
||||
|
||||
Copyright (c) 2018 Seeed Technology Co., Ltd.
|
||||
Website : www.seeed.cc
|
||||
Author : downey
|
||||
Create Time: sep. 2018
|
||||
Change Log :
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#include <Wire.h>
|
||||
|
||||
#include "grove_alphanumeric_display.h"
|
||||
|
||||
Seeed_Digital_Tube tube;
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
Wire.begin();
|
||||
|
||||
// If using four digital tubes, use this configuration.
|
||||
tube.setTubeType(TYPE_4,TYPE_4_DEFAULT_I2C_ADDR);
|
||||
tube.setTubeType(TYPE_4, TYPE_4_DEFAULT_I2C_ADDR);
|
||||
|
||||
// If using two digital tubes, use this configuration.
|
||||
// tube.setTubeType(TYPE_2,TYPE_2_DEFAULT_I2C_ADDR);
|
||||
|
||||
tube.setBrightness(15);
|
||||
tube.setBlinkRate(BLINK_OFF);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
|
||||
void loop() {
|
||||
|
||||
tube.displayNum(12);
|
||||
delay(2000);
|
||||
|
||||
tube.displayNum(4567,500);
|
||||
tube.displayNum(4567, 500);
|
||||
delay(2000);
|
||||
|
||||
tube.displayString("AB",500);
|
||||
tube.displayString("AB", 500);
|
||||
delay(2000);
|
||||
|
||||
tube.displayString("abcd",500);
|
||||
tube.displayString("abcd", 500);
|
||||
delay(2000);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,33 +1,33 @@
|
||||
/*
|
||||
* display_custom.ino
|
||||
* Example for digital tube.
|
||||
*
|
||||
* Copyright (c) 2018 Seeed Technology Co., Ltd.
|
||||
* Website : www.seeed.cc
|
||||
* Author : downey
|
||||
* Create Time: sep. 2018
|
||||
* Change Log :
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
display_custom.ino
|
||||
Example for digital tube.
|
||||
|
||||
Copyright (c) 2018 Seeed Technology Co., Ltd.
|
||||
Website : www.seeed.cc
|
||||
Author : downey
|
||||
Create Time: sep. 2018
|
||||
Change Log :
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#include <Wire.h>
|
||||
|
||||
|
||||
@@ -36,43 +36,40 @@
|
||||
Seeed_Digital_Tube tube;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
Wire.begin();
|
||||
|
||||
|
||||
// If using two digital tubes, use this configuration.
|
||||
// tube.setTubeType(TYPE_2,TYPE_2_DEFAULT_I2C_ADDR);
|
||||
|
||||
// If using four digital tubes, use this configuration.
|
||||
tube.setTubeType(TYPE_4,TYPE_4_DEFAULT_I2C_ADDR);
|
||||
|
||||
tube.setTubeType(TYPE_4, TYPE_4_DEFAULT_I2C_ADDR);
|
||||
|
||||
|
||||
tube.setBrightness(15);
|
||||
tube.setBlinkRate(BLINK_1HZ);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void displayCustom()
|
||||
{
|
||||
void displayCustom() {
|
||||
tube.clearBuf();
|
||||
tube.setTubeSingleChar(FIRST_TUBE,'t');
|
||||
tube.setTubeSingleChar(SECOND_TUBE,'T');
|
||||
tube.setTubeSingleChar(FIRST_TUBE, 't');
|
||||
tube.setTubeSingleChar(SECOND_TUBE, 'T');
|
||||
|
||||
//if using two digital tubes,there's no third&fourth channel.
|
||||
|
||||
tube.setTubeSingleNum(THIRD_TUBE,5);
|
||||
tube.setTubeSingleNum(FOURTH_TUBE,5);
|
||||
tube.setTubeSingleNum(THIRD_TUBE, 5);
|
||||
tube.setTubeSingleNum(FOURTH_TUBE, 5);
|
||||
|
||||
// The location of point is different between two&four digital tubes.
|
||||
tube.setPoint(true,false);
|
||||
tube.setPoint(true, false);
|
||||
|
||||
tube.display();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
void loop() {
|
||||
displayCustom();
|
||||
delay(2000);
|
||||
}
|
||||
@@ -1,33 +1,33 @@
|
||||
/*
|
||||
* display_scroll_number.ino
|
||||
* Example for digital tube.
|
||||
*
|
||||
* Copyright (c) 2018 Seeed Technology Co., Ltd.
|
||||
* Website : www.seeed.cc
|
||||
* Author : downey
|
||||
* Create Time: sep. 2018
|
||||
* Change Log :
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
display_scroll_number.ino
|
||||
Example for digital tube.
|
||||
|
||||
Copyright (c) 2018 Seeed Technology Co., Ltd.
|
||||
Website : www.seeed.cc
|
||||
Author : downey
|
||||
Create Time: sep. 2018
|
||||
Change Log :
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include "grove_alphanumeric_display.h"
|
||||
|
||||
@@ -36,15 +36,14 @@ Seeed_Digital_Tube tube;
|
||||
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
Wire.begin();
|
||||
|
||||
// If using two digital tubes, use this configuration.
|
||||
// tube.setTubeType(TYPE_2,TYPE_2_DEFAULT_I2C_ADDR);
|
||||
|
||||
// If using four digital tubes, use this configuration.
|
||||
tube.setTubeType(TYPE_4,TYPE_4_DEFAULT_I2C_ADDR);
|
||||
tube.setTubeType(TYPE_4, TYPE_4_DEFAULT_I2C_ADDR);
|
||||
|
||||
tube.setBrightness(15);
|
||||
tube.setBlinkRate(BLINK_OFF);
|
||||
@@ -52,8 +51,7 @@ void setup()
|
||||
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
tube.displayNum(1234567,500);
|
||||
void loop() {
|
||||
tube.displayNum(1234567, 500);
|
||||
delay(1000);
|
||||
}
|
||||
@@ -1,33 +1,33 @@
|
||||
/*
|
||||
* display_scroll_string.ino
|
||||
* Driver for digital tube.
|
||||
*
|
||||
* Copyright (c) 2018 Seeed Technology Co., Ltd.
|
||||
* Website : www.seeed.cc
|
||||
* Author : downey
|
||||
* Create Time: sep. 2018
|
||||
* Change Log :
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
display_scroll_string.ino
|
||||
Driver for digital tube.
|
||||
|
||||
Copyright (c) 2018 Seeed Technology Co., Ltd.
|
||||
Website : www.seeed.cc
|
||||
Author : downey
|
||||
Create Time: sep. 2018
|
||||
Change Log :
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include "grove_alphanumeric_display.h"
|
||||
|
||||
@@ -35,15 +35,14 @@ Seeed_Digital_Tube tube;
|
||||
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
Wire.begin();
|
||||
|
||||
|
||||
// If using two digital tubes, use this configuration.
|
||||
// tube.setTubeType(TYPE_2,TYPE_2_DEFAULT_I2C_ADDR);
|
||||
|
||||
// If using four digital tubes, use this configuration.
|
||||
tube.setTubeType(TYPE_4,TYPE_4_DEFAULT_I2C_ADDR);
|
||||
tube.setTubeType(TYPE_4, TYPE_4_DEFAULT_I2C_ADDR);
|
||||
|
||||
tube.setBrightness(15);
|
||||
tube.setBlinkRate(BLINK_OFF);
|
||||
@@ -51,8 +50,7 @@ void setup()
|
||||
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
tube.displayString("ABCDEFGHIJK",500);
|
||||
void loop() {
|
||||
tube.displayString("ABCDEFGHIJK", 500);
|
||||
delay(1000);
|
||||
}
|
||||
@@ -1,30 +1,30 @@
|
||||
/*
|
||||
display_basic.ino
|
||||
Example for displaying specific segments on a tube.
|
||||
display_basic.ino
|
||||
Example for displaying specific segments on a tube.
|
||||
|
||||
|
||||
Author : dagwoodland
|
||||
Create Time: Sep 2019
|
||||
Author : dagwoodland
|
||||
Create Time: Sep 2019
|
||||
|
||||
The MIT License (MIT)
|
||||
The MIT License (MIT)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "Wire.h"
|
||||
@@ -35,20 +35,20 @@ int currentSegment = 0;
|
||||
|
||||
// The frames of tube 2's animation.
|
||||
uint16_t tubeTwoFrames[] = {
|
||||
SEGMENT_TOP,
|
||||
SEGMENT_TOP_LEFT,
|
||||
SEGMENT_TOP_LEFT_DIAGONAL,
|
||||
SEGMENT_TOP_VERTICAL,
|
||||
SEGMENT_TOP_RIGHT_DIAGONAL,
|
||||
SEGMENT_TOP_RIGHT,
|
||||
SEGMENT_MIDDLE_LEFT,
|
||||
SEGMENT_MIDDLE_RIGHT,
|
||||
SEGMENT_BOTTOM_LEFT,
|
||||
SEGMENT_BOTTOM_LEFT_DIAGONAL,
|
||||
SEGMENT_BOTTOM_VERTICAL,
|
||||
SEGMENT_BOTTOM_RIGHT_DIAGONAL,
|
||||
SEGMENT_BOTTOM_RIGHT,
|
||||
SEGMENT_BOTTOM
|
||||
SEGMENT_TOP,
|
||||
SEGMENT_TOP_LEFT,
|
||||
SEGMENT_TOP_LEFT_DIAGONAL,
|
||||
SEGMENT_TOP_VERTICAL,
|
||||
SEGMENT_TOP_RIGHT_DIAGONAL,
|
||||
SEGMENT_TOP_RIGHT,
|
||||
SEGMENT_MIDDLE_LEFT,
|
||||
SEGMENT_MIDDLE_RIGHT,
|
||||
SEGMENT_BOTTOM_LEFT,
|
||||
SEGMENT_BOTTOM_LEFT_DIAGONAL,
|
||||
SEGMENT_BOTTOM_VERTICAL,
|
||||
SEGMENT_BOTTOM_RIGHT_DIAGONAL,
|
||||
SEGMENT_BOTTOM_RIGHT,
|
||||
SEGMENT_BOTTOM
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------
|
||||
@@ -61,50 +61,50 @@ uint16_t tubeTwoFrames[] = {
|
||||
Seeed_Digital_Tube tube;
|
||||
|
||||
void setup() {
|
||||
// Setup wire using default I2C pins.
|
||||
Wire.begin();
|
||||
// Setup wire using default I2C pins.
|
||||
Wire.begin();
|
||||
|
||||
// If using four digital tubes, use this configuration.
|
||||
tube.setTubeType(TYPE_4, TYPE_4_DEFAULT_I2C_ADDR);
|
||||
// If using four digital tubes, use this configuration.
|
||||
tube.setTubeType(TYPE_4, TYPE_4_DEFAULT_I2C_ADDR);
|
||||
|
||||
// If using two digital tubes, use this configuration.
|
||||
// tube.setTubeType(TYPE_2,TYPE_2_DEFAULT_I2C_ADDR);
|
||||
// If using two digital tubes, use this configuration.
|
||||
// tube.setTubeType(TYPE_2,TYPE_2_DEFAULT_I2C_ADDR);
|
||||
|
||||
tube.setBrightness(15);
|
||||
tube.setBlinkRate(BLINK_OFF);
|
||||
tube.setBrightness(15);
|
||||
tube.setBlinkRate(BLINK_OFF);
|
||||
}
|
||||
|
||||
// Display the top and bottom segments on the first tube.
|
||||
void displayTubeOne() {
|
||||
// To display specific segments add together their values.
|
||||
tube.setTubeSegments(FIRST_TUBE, SEGMENT_TOP + SEGMENT_BOTTOM);
|
||||
// To display specific segments add together their values.
|
||||
tube.setTubeSegments(FIRST_TUBE, SEGMENT_TOP + SEGMENT_BOTTOM);
|
||||
}
|
||||
|
||||
// Display an animation going through all 14 segments in turn.
|
||||
void displayTubeTwo() {
|
||||
// Increment tube 2's animation frame.
|
||||
currentSegment += 1;
|
||||
// Increment tube 2's animation frame.
|
||||
currentSegment += 1;
|
||||
|
||||
// Restart the animation if it has finished.
|
||||
if (currentSegment >= 14) {
|
||||
currentSegment = 0;
|
||||
}
|
||||
// Restart the animation if it has finished.
|
||||
if (currentSegment >= 14) {
|
||||
currentSegment = 0;
|
||||
}
|
||||
|
||||
// Display the current frame of tube 2's animation.
|
||||
tube.setTubeSegments(SECOND_TUBE, tubeTwoFrames[currentSegment]);
|
||||
// Display the current frame of tube 2's animation.
|
||||
tube.setTubeSegments(SECOND_TUBE, tubeTwoFrames[currentSegment]);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Clear the tube's buffer. Using tube.clearBuf() prevents
|
||||
// the display blinking because the display is not updated
|
||||
// until tube.display() is called, unlike tube.clear()
|
||||
tube.clearBuf();
|
||||
// Clear the tube's buffer. Using tube.clearBuf() prevents
|
||||
// the display blinking because the display is not updated
|
||||
// until tube.display() is called, unlike tube.clear()
|
||||
tube.clearBuf();
|
||||
|
||||
displayTubeOne();
|
||||
displayTubeTwo();
|
||||
displayTubeOne();
|
||||
displayTubeTwo();
|
||||
|
||||
// Display the new contents of both tube's buffers.
|
||||
tube.display();
|
||||
// Display the new contents of both tube's buffers.
|
||||
tube.display();
|
||||
|
||||
delay(200);
|
||||
delay(200);
|
||||
}
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
/*
|
||||
* number_increment.ino
|
||||
* Driver for digital tube.
|
||||
*
|
||||
* Copyright (c) 2018 Seeed Technology Co., Ltd.
|
||||
* Website : www.seeed.cc
|
||||
* Author : downey
|
||||
* Create Time: sep. 2018
|
||||
* Change Log :
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
number_increment.ino
|
||||
Driver for digital tube.
|
||||
|
||||
Copyright (c) 2018 Seeed Technology Co., Ltd.
|
||||
Website : www.seeed.cc
|
||||
Author : downey
|
||||
Create Time: sep. 2018
|
||||
Change Log :
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include "grove_alphanumeric_display.h"
|
||||
|
||||
@@ -36,51 +36,43 @@ Seeed_Digital_Tube tube;
|
||||
|
||||
char hex_str[10];
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
Wire.begin();
|
||||
|
||||
|
||||
// If using two digital tubes, use this configuration.
|
||||
// tube.setTubeType(TYPE_2,TYPE_2_DEFAULT_I2C_ADDR);
|
||||
|
||||
// If using four digital tubes, use this configuration.
|
||||
tube.setTubeType(TYPE_4,TYPE_4_DEFAULT_I2C_ADDR);
|
||||
tube.setTubeType(TYPE_4, TYPE_4_DEFAULT_I2C_ADDR);
|
||||
|
||||
tube.setBrightness(15);
|
||||
tube.setBlinkRate(BLINK_OFF);
|
||||
|
||||
|
||||
}
|
||||
|
||||
char* numToHexString(unsigned int num)
|
||||
{
|
||||
if(num <= 0xf){
|
||||
sprintf(hex_str,"0%x",num);
|
||||
for(int i=0;i<2;i++)
|
||||
{
|
||||
if(hex_str[i] >= 'a' && hex_str[i] <= 'z')
|
||||
{
|
||||
hex_str[i] -=0x20;
|
||||
char* numToHexString(unsigned int num) {
|
||||
if (num <= 0xf) {
|
||||
sprintf(hex_str, "0%x", num);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (hex_str[i] >= 'a' && hex_str[i] <= 'z') {
|
||||
hex_str[i] -= 0x20;
|
||||
}
|
||||
}
|
||||
return hex_str;
|
||||
}
|
||||
sprintf(hex_str,"%x",num);
|
||||
for(int i=0;i<2;i++)
|
||||
{
|
||||
if(hex_str[i] >= 'a' && hex_str[i] <= 'z')
|
||||
{
|
||||
hex_str[i] -=0x20;
|
||||
sprintf(hex_str, "%x", num);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (hex_str[i] >= 'a' && hex_str[i] <= 'z') {
|
||||
hex_str[i] -= 0x20;
|
||||
}
|
||||
}
|
||||
return hex_str;
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
for(int i=0;i<0xff;i++)
|
||||
{
|
||||
tube.displayString(numToHexString(i),0);
|
||||
void loop() {
|
||||
for (int i = 0; i < 0xff; i++) {
|
||||
tube.displayString(numToHexString(i), 0);
|
||||
delay(100);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user