EasyManuals Logo

Arduino Pro Mini User Manual

Arduino Pro Mini
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #159 background imageLoading...
Page #159 background image
Figure 25You can find good online editors for pixel graphics.
When ImageMagick is available on your system, you can install the rmagick
library using the following command:
maik> gem install rmagick
Now you can use rmagick in your Ruby programs. Well use it to convert a
graphics file into a C++ file:
Video/img2cpp.rb
require 'RMagick'
Line 1
include Magick
-
-
image = Image::read(ARGV[0]).first
-
5
puts '#include "thermometer.h"'
-
puts 'PROGMEM const unsigned char thermometer[] = {'
-
puts " #{image.columns}, #{image.rows},"
-
-
(0..image.rows).each do |y|
10
print ' B'
-
(0..image.columns).each do |x|
-
pixel = image.pixel_color(x, y)
-
print pixel.red == 0 ? '0' : '1'
-
print ', B' if (x + 1) % 8 == 0
15
Chapter 8. Generating Video Signals with an Arduino 142
report erratum discuss
www.it-ebooks.info

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino Pro Mini and is the answer not in the manual?

Arduino Pro Mini Specifications

General IconGeneral
BrandArduino
ModelPro Mini
CategoryMotherboard
LanguageEnglish

Related product manuals