1#[cfg(feature = "default")]
2extern crate sensehat_screen;
3
4#[cfg(feature = "default")]
5use sensehat_screen::Offset;
6#[cfg(feature = "default")]
7use sensehat_screen::{font_to_pixel_frame, FontCollection, PixelColor, PixelFrame, Screen};
8
9#[cfg(not(feature = "default"))]
10fn main() {
11 unimplemented!("This examples needs the 'default' features.");
12}
13#[cfg(feature = "default")]
14fn main() {
15 let mut screen = Screen::open("/dev/fb1").unwrap();
16 let fonts = FontCollection::new();
17
18 for &(sym, color) in &[('þ', PixelColor::CYAN), ('ß', PixelColor::WHITE.dim(0.5))] {
19 let font = fonts.get(sym).unwrap();
20 let symbol = font_to_pixel_frame(font.byte_array(), color);
21
22 for i in 0..=8 {
26 screen.write_frame(&symbol.offset(Offset::left(8 - i)).frame_line());
27 ::std::thread::sleep(::std::time::Duration::from_millis(500));
28 }
29 for i in 0..=8 {
31 screen.write_frame(&symbol.offset(Offset::right(i)).frame_line());
32 ::std::thread::sleep(::std::time::Duration::from_millis(500));
33 }
34
35 for i in 0..=8 {
39 screen.write_frame(&symbol.offset(Offset::top(8 - i)).frame_line());
40 ::std::thread::sleep(::std::time::Duration::from_millis(500));
41 }
42 for i in 0..=8 {
44 screen.write_frame(&symbol.offset(Offset::bottom(i)).frame_line());
45 ::std::thread::sleep(::std::time::Duration::from_millis(500));
46 }
47 }
48 screen.write_frame(&PixelFrame::new(&[PixelColor::BLACK; 64]).frame_line());
49}