Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ros-lcd-i2c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Victor
ros-lcd-i2c
Commits
44a4e985
Commit
44a4e985
authored
Sep 08, 2020
by
Victor Dubois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
creation
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
lcd_i2c.ino
lcd_i2c.ino
+54
-0
No files found.
lcd_i2c.ino
0 → 100644
View file @
44a4e985
//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <ros.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <std_msgs/UInt32.h>
LiquidCrystal_I2C
lcd
(
0x27
,
16
,
2
);
// set the LCD address to 0x27 for a 16 chars and 2 line display
ros
::
NodeHandle
nh
;
void
scoreCb
(
const
std_msgs
::
UInt32
&
score
){
lcd
.
setCursor
(
13
,
1
);
uint32_t
hundreds
=
(
score
.
data
%
1000
-
score
.
data
%
100
)
/
100
;
uint32_t
units
=
score
.
data
%
10
;
uint32_t
tens
=
(
score
.
data
%
1000
-
hundreds
*
100
-
units
)
/
10
;
lcd
.
print
(
hundreds
);
lcd
.
print
(
tens
);
lcd
.
print
(
units
);
}
ros
::
Subscriber
<
std_msgs
::
UInt32
>
score_sub
(
"score"
,
&
scoreCb
);
void
setup
()
{
lcd
.
init
();
// initialize the lcd
lcd
.
init
();
// Print a message to the LCD.
lcd
.
backlight
();
lcd
.
setCursor
(
7
,
1
);
lcd
.
print
(
"Score:"
);
lcd
.
setCursor
(
0
,
0
);
lcd
.
print
(
"X"
);
lcd
.
setCursor
(
6
,
0
);
lcd
.
print
(
"Y"
);
lcd
.
setCursor
(
12
,
0
);
lcd
.
print
(
"T"
);
lcd
.
setCursor
(
0
,
1
);
lcd
.
print
(
"T"
);
nh
.
initNode
();
nh
.
subscribe
(
score_sub
);
}
void
loop
()
{
nh
.
spinOnce
();
delay
(
10
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment