/.
kmd n
-NB PB /. IFDEPB BA M
n Yilf
L E DB PEB F DB
: NLII M
a bc
k t oW
EBNB FO 8F F LNAF N EL B W
a bc
k t oW
EBNB FO 8F F LNAF N EL B W
a
LAA F N EL B
/.
c k
L HB /. OFD DB
2 NAS NB
/. PNFT 8 BI
OM BNN 8F






1 PNFT 2
n
-L B P I AO MB M BIO RBNPF II
w
BF CLN B I H P MB


v su yb k
0FT L LLH OP AO D BP
:LCPS NB




OM F
7: OBP M
git libgraphicsmagick++-dev libwebp-dev
8F 1 /. PNFT
1BP F ! HB
$ git clone https://github.com/
hzeller/rpi-rgb-led-matrix
$ cd rpi-rgb-led-matrix
$ make -C examples-api-use
$ cd utils
$ make led-image-viewer
.B L
$ cd example-api-use
$ sudo ./demo 

--led-gpio-mapping=adafruit-hat 
--led-no-hardware-pulse 
--led-chain=4 -L 

-D 0
md
:ELS S M
md n
-LIIB P S M F DBO
b ek
NN DB PEB
: NLII .B L
$ sudo ./demo 

--led-gpio-mapping=adafruit-hat 
--led-no-hardware-pulse 
--led-chain=4 -L 

-D 1 ../../images/wapuu.ppm
:BIB P 8
8 8
8 8
-NB PB 8
- OPL / A 8LF P
/wp-json/wapuu/v1/set/nnn
/wp-json/wapuu/v1/get
p y o x
AA B A MLF P
add_action( 'rest_api_init', function () {
register_rest_route( 'wapuu/v1', '/set/(?P<id>d+)', array(
'methods' => 'POST',
'callback' => 'set_wapuu_image',
'args' => array(
'id' => array(
'validate_callback' => function($param, $request, $key) {
return is_numeric( $param );
}
),
),
) );
register_rest_route( 'wapuu/v1', '/get', array(
'methods' => 'GET',
'callback' => 'get_wapuu_image',
) );
} );
n
:BP 1BP DB BN
function set_wapuu_image( $data ) {
$id = $data['id'];
update_post_meta( 60, 'wapuu-image', $id );
$data = array( 'id' => $id );
return new WP_REST_Response( $data, 200 );
}
function get_wapuu_image() {
$id = get_post_meta( 60, 'wapuu-image');
$data = array( 'id' => $id );
return new WP_REST_Response( $data, 200 );
}
8 BOML OB
http://example.net/wp-json/
wapuu/v1/get
{"id":"001"}
8 PEL LAB
L O8F
8 hj
1BP F DB BN CNL 8
api="http://example.net/wp-json/wapuu/v1/get"
def img_number():
try:
html = urllib.urlopen( api ).read()
except:
return None
data = json.loads(html)
return data['id']
n
BPNFBRB F DB CNL BN
image_dir = "~/wapuu/"
viewer = "~/rpi-rgb-led-matrix/utils/led-image-viewer"
opt = " --led-daemon --led-gpio-mapping=adafruit-hat" +
" --led-no-hardware-pulse --led-chain=4 -L"
prev = None
while True:
time.sleep(2)
number = img_number()
if number is None: continue
files = glob.glob(image_dir+number+"-*.png")
if len(files) < 1: continue
if files[0] == prev: continue
if prev is not None: kill_img()
commands.getstatusoutput("sudo "+viewer+opt+files[0])
prev = files[0]
j Y c n
/N OB MNBRFL O F DB
pattern = r"^ *(d+) .*/led-image-viewer"
def kill_img ():
id = []
ps_list = commands.getoutput('ps awx')
for process in ps_list.split("n"):
match = re.match(pattern, process)
if not match: continue
id.append(match.group(1))
commands.getoutput("sudo kill "+" ".join(id))
r
:BIB PLN 8 DB
<form method="post"
action="/wp-json/wapuu/v1/set/001">
<div>[caption id="attachment_40"
align="alignleft" width="150"]
<img src="/wp-content/uploads/
2017/09/001-original-150x150.png"
alt="001" width="150" height="150"
class="size-thumbnail wp-image-40" />
Original (WordCamp 2011 Fukuoka)<br>
<button type="submit" value="001">

Submit</button>
[/caption]</div></form>
7.7




LNA0BO g
.FOMI P LNA0BO F DL
& &
http://www.yuriko.net/
@lilyfanjp
EPPMO SSS OIFABOE NB BP
IFI C IBA PNFT S M
EPPMO DFPE L IFI C GM
S M IBA

Create LED lightened Wapuu (LEDパネルで光るわぷーを)

  • 1.
    /. kmd n -NB PB/. IFDEPB BA M
  • 2.
    n Yilf L EDB PEB F DB
  • 3.
  • 4.
    a bc k toW EBNB FO 8F F LNAF N EL B W
  • 5.
    a bc k toW EBNB FO 8F F LNAF N EL B W a LAA F N EL B
  • 6.
    /. c k L HB/. OFD DB
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
    n -L B PI AO MB M BIO RBNPF II
  • 12.
    w BF CLN BI H P MB 

  • 13.
    v su ybk 0FT L LLH OP AO D BP
  • 14.
  • 15.
  • 16.
    7: OBP M gitlibgraphicsmagick++-dev libwebp-dev
  • 17.
    8F 1 /.PNFT
  • 18.
    1BP F !HB $ git clone https://github.com/ hzeller/rpi-rgb-led-matrix $ cd rpi-rgb-led-matrix $ make -C examples-api-use $ cd utils $ make led-image-viewer
  • 19.
    .B L $ cdexample-api-use $ sudo ./demo 
 --led-gpio-mapping=adafruit-hat --led-no-hardware-pulse --led-chain=4 -L 
 -D 0
  • 20.
  • 21.
    md n -LIIB PS M F DBO
  • 22.
  • 23.
    : NLII .BL $ sudo ./demo 
 --led-gpio-mapping=adafruit-hat --led-no-hardware-pulse --led-chain=4 -L 
 -D 1 ../../images/wapuu.ppm
  • 24.
  • 25.
  • 26.
  • 27.
    - OPL /A 8LF P /wp-json/wapuu/v1/set/nnn /wp-json/wapuu/v1/get
  • 28.
    p y ox AA B A MLF P add_action( 'rest_api_init', function () { register_rest_route( 'wapuu/v1', '/set/(?P<id>d+)', array( 'methods' => 'POST', 'callback' => 'set_wapuu_image', 'args' => array( 'id' => array( 'validate_callback' => function($param, $request, $key) { return is_numeric( $param ); } ), ), ) ); register_rest_route( 'wapuu/v1', '/get', array( 'methods' => 'GET', 'callback' => 'get_wapuu_image', ) ); } );
  • 29.
    n :BP 1BP DBBN function set_wapuu_image( $data ) { $id = $data['id']; update_post_meta( 60, 'wapuu-image', $id ); $data = array( 'id' => $id ); return new WP_REST_Response( $data, 200 ); } function get_wapuu_image() { $id = get_post_meta( 60, 'wapuu-image'); $data = array( 'id' => $id ); return new WP_REST_Response( $data, 200 ); }
  • 30.
  • 31.
  • 32.
    8 hj 1BP FDB BN CNL 8 api="http://example.net/wp-json/wapuu/v1/get" def img_number(): try: html = urllib.urlopen( api ).read() except: return None data = json.loads(html) return data['id']
  • 33.
    n BPNFBRB F DBCNL BN image_dir = "~/wapuu/" viewer = "~/rpi-rgb-led-matrix/utils/led-image-viewer" opt = " --led-daemon --led-gpio-mapping=adafruit-hat" + " --led-no-hardware-pulse --led-chain=4 -L" prev = None while True: time.sleep(2) number = img_number() if number is None: continue files = glob.glob(image_dir+number+"-*.png") if len(files) < 1: continue if files[0] == prev: continue if prev is not None: kill_img() commands.getstatusoutput("sudo "+viewer+opt+files[0]) prev = files[0]
  • 34.
    j Y cn /N OB MNBRFL O F DB pattern = r"^ *(d+) .*/led-image-viewer" def kill_img (): id = [] ps_list = commands.getoutput('ps awx') for process in ps_list.split("n"): match = re.match(pattern, process) if not match: continue id.append(match.group(1)) commands.getoutput("sudo kill "+" ".join(id))
  • 35.
    r :BIB PLN 8DB <form method="post" action="/wp-json/wapuu/v1/set/001"> <div>[caption id="attachment_40" align="alignleft" width="150"] <img src="/wp-content/uploads/ 2017/09/001-original-150x150.png" alt="001" width="150" height="150" class="size-thumbnail wp-image-40" /> Original (WordCamp 2011 Fukuoka)<br> <button type="submit" value="001">
 Submit</button> [/caption]</div></form>
  • 37.
  • 38.
    LNA0BO g .FOMI PLNA0BO F DL & &
  • 39.
    http://www.yuriko.net/ @lilyfanjp EPPMO SSS OIFABOENB BP IFI C IBA PNFT S M EPPMO DFPE L IFI C GM S M IBA