Add files via upload

This commit is contained in:
Dominic Monette
2020-07-13 06:42:48 -04:00
committed by GitHub
parent db35ee9cff
commit 0ded9cf98b
92 changed files with 13631 additions and 0 deletions

156
--verbose Normal file
View File

@@ -0,0 +1,156 @@
== Info: Trying 35.244.163.133...
== Info: TCP_NODELAY set
== Info: Connected to app.vestaboard.com (35.244.163.133) port 443 (#0)
== Info: ALPN, offering h2
== Info: ALPN, offering http/1.1
== Info: Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
== Info: successfully set certificate verify locations:
== Info: CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
== Info: TLSv1.2 (OUT), TLS header, Certificate Status (22):
=> Send SSL data, 5 bytes (0x5)
0000: 16 03 01 02 00 .....
== Info: TLSv1.2 (OUT), TLS handshake, Client hello (1):
=> Send SSL data, 512 bytes (0x200)
0000: 01 00 01 fc 03 03 95 5e cc 35 13 38 4d 7b ca e0 .......^.5.8M{..
0010: 9a e4 63 34 56 c1 49 b1 70 5f a6 67 1f 10 2f 0d ..c4V.I.p_.g../.
0020: 62 dd b1 6d 0e fa 00 00 8c c0 30 c0 2c c0 28 c0 b..m......0.,.(.
0030: 24 c0 14 c0 0a 00 a5 00 a3 00 a1 00 9f 00 6b 00 $.............k.
0040: 6a 00 69 00 68 00 39 00 38 00 37 00 36 00 88 00 j.i.h.9.8.7.6...
0050: 87 00 86 00 85 c0 32 c0 2e c0 2a c0 26 c0 0f c0 ......2...*.&...
0060: 05 00 9d 00 3d 00 35 00 84 c0 2f c0 2b c0 27 c0 ....=.5.../.+.'.
0070: 23 c0 13 c0 09 00 a4 00 a2 00 a0 00 9e 00 67 00 #.............g.
0080: 40 00 3f 00 3e 00 33 00 32 00 31 00 30 00 9a 00 @.?.>.3.2.1.0...
0090: 99 00 98 00 97 00 45 00 44 00 43 00 42 c0 31 c0 ......E.D.C.B.1.
00a0: 2d c0 29 c0 25 c0 0e c0 04 00 9c 00 3c 00 2f 00 -.).%.......<./.
00b0: 96 00 41 00 ff 01 00 01 47 00 00 00 17 00 15 00 ..A.....G.......
00c0: 00 12 61 70 70 2e 76 65 73 74 61 62 6f 61 72 64 ..app.vestaboard
00d0: 2e 63 6f 6d 00 0b 00 04 03 00 01 02 00 0a 00 1c .com............
00e0: 00 1a 00 17 00 19 00 1c 00 1b 00 18 00 1a 00 16 ................
00f0: 00 0e 00 0d 00 0b 00 0c 00 09 00 0a 00 0d 00 20 ...............
0100: 00 1e 06 01 06 02 06 03 05 01 05 02 05 03 04 01 ................
0110: 04 02 04 03 03 01 03 02 03 03 02 01 02 02 02 03 ................
0120: 00 0f 00 01 01 33 74 00 00 00 10 00 0e 00 0c 02 .....3t.........
0130: 68 32 08 68 74 74 70 2f 31 2e 31 00 15 00 c1 00 h2.http/1.1.....
0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
<= Recv SSL data, 5 bytes (0x5)
0000: 16 03 03 00 60 ....`
== Info: TLSv1.2 (IN), TLS handshake, Server hello (2):
<= Recv SSL data, 96 bytes (0x60)
0000: 02 00 00 5c 03 03 5c 3e 2c 0c 47 db 38 35 9d 5c ...\..\>,.G.85.\
0010: 73 13 71 9c b5 d8 42 9d 59 26 5a df 5e f0 a2 a1 s.q...B.Y&Z.^...
0020: e3 8d b7 95 2e db 20 ef b7 60 cc be 87 bb 32 32 ...... ..`....22
0030: 64 53 e0 b7 75 bf d6 be 64 1c 20 f4 d5 0f 87 25 dS..u...d. ....%
0040: 5b f5 5b fd 88 44 49 c0 2f 00 00 14 ff 01 00 01 [.[..DI./.......
0050: 00 00 0b 00 02 01 00 00 10 00 05 00 03 02 68 32 ..............h2
<= Recv SSL data, 5 bytes (0x5)
0000: 16 03 03 05 6a ....j
== Info: TLSv1.2 (IN), TLS handshake, Certificate (11):
<= Recv SSL data, 1386 bytes (0x56a)
0000: 0b 00 05 66 00 05 63 00 05 60 30 82 05 5c 30 82 ...f..c..`0..\0.
0010: 04 44 a0 03 02 01 02 02 12 03 22 cb 7d 87 d2 ad .D........".}...
0020: 1b f9 49 78 2a 61 68 c3 9b e7 97 30 0d 06 09 2a ..Ix*ah....0...*
0030: 86 48 86 f7 0d 01 01 0b 05 00 30 4a 31 0b 30 09 .H........0J1.0.
0040: 06 03 55 04 06 13 02 55 53 31 16 30 14 06 03 55 ..U....US1.0...U
0050: 04 0a 13 0d 4c 65 74 27 73 20 45 6e 63 72 79 70 ....Let's Encryp
0060: 74 31 23 30 21 06 03 55 04 03 13 1a 4c 65 74 27 t1#0!..U....Let'
0070: 73 20 45 6e 63 72 79 70 74 20 41 75 74 68 6f 72 s Encrypt Author
0080: 69 74 79 20 58 33 30 1e 17 0d 31 39 30 31 31 33 ity X30...190113
0090: 31 34 31 32 33 34 5a 17 0d 31 39 30 34 31 33 31 141234Z..1904131
00a0: 34 31 32 33 34 5a 30 1d 31 1b 30 19 06 03 55 04 41234Z0.1.0...U.
00b0: 03 13 12 61 70 70 2e 76 65 73 74 61 62 6f 61 72 ...app.vestaboar
00c0: 64 2e 63 6f 6d 30 82 01 22 30 0d 06 09 2a 86 48 d.com0.."0...*.H
00d0: 86 f7 0d 01 01 01 05 00 03 82 01 0f 00 30 82 01 .............0..
00e0: 0a 02 82 01 01 00 c2 69 c8 2f 11 1e 97 d1 c2 92 .......i./......
00f0: 98 2c 57 5d 8a 3e 14 94 f8 8d f9 1c f4 30 39 ad .,W].>.......09.
0100: 20 14 b2 e1 7f 5c b2 40 29 de 9b a3 fa 00 58 5c ...\.@).....X\
0110: be fd d9 99 56 b2 11 89 13 25 47 41 61 9d 5d 9c ....V....%GAa.].
0120: 2b 3f 17 a5 b8 66 62 25 90 89 1d 29 91 c9 9f 95 +?...fb%...)....
0130: 79 ba 53 61 ed d5 76 fe 59 af 38 24 98 3b c0 af y.Sa..v.Y.8$.;..
0140: f8 1e 95 f7 2b 10 3a 55 8d 2c e9 d9 2b 6a f7 bc ....+.:U.,..+j..
0150: c5 1f 61 50 65 0d 94 71 73 02 66 ad a2 0f f7 97 ..aPe..qs.f.....
0160: 91 5e 15 99 8e 67 e2 04 77 db 2f 22 f5 2b d8 32 .^...g..w./".+.2
0170: 92 f2 28 76 99 d8 a5 e3 40 0a 72 9c 4d bb 53 66 ..(v....@.r.M.Sf
0180: 5e c2 0f 04 c1 bf 66 0b 15 2c d3 98 d0 28 e9 96 ^.....f..,...(..
0190: 89 bb 24 6e 74 40 92 a2 f3 86 d2 5a c3 18 2c b1 ..$nt@.....Z..,.
01a0: d8 26 4e f5 11 bf 91 06 81 75 3e f4 a1 6f 76 ea .&N......u>..ov.
01b0: 88 9e 19 8f a0 c9 22 f7 a2 da 97 18 95 3d e5 72 ......"......=.r
01c0: 6d 3e a3 35 71 41 41 76 7b a7 d5 9d 56 66 61 79 m>.5qAAv{...Vfay
01d0: a9 7c ad 6a 4c 05 0a 63 8d 4a 36 42 e1 60 fc 87 .|.jL..c.J6B.`..
01e0: 37 c3 05 ac 87 a9 02 03 01 00 01 a3 82 02 67 30 7.............g0
01f0: 82 02 63 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 ..c0...U........
0200: 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 ...0...U.%..0...
0210: 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 +.........+.....
0220: 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 ..0...U.......0.
0230: 30 1d 06 03 55 1d 0e 04 16 04 14 e1 22 d4 21 32 0...U.......".!2
0240: 6a fd 81 e8 0e f6 46 5c 79 9d e6 7e 69 85 bb 30 j.....F\y..~i..0
0250: 1f 06 03 55 1d 23 04 18 30 16 80 14 a8 4a 6a 63 ...U.#..0....Jjc
0260: 04 7d dd ba e6 d1 39 b7 a6 45 65 ef f3 a8 ec a1 .}....9..Ee.....
0270: 30 6f 06 08 2b 06 01 05 05 07 01 01 04 63 30 61 0o..+........c0a
0280: 30 2e 06 08 2b 06 01 05 05 07 30 01 86 22 68 74 0...+.....0.."ht
0290: 74 70 3a 2f 2f 6f 63 73 70 2e 69 6e 74 2d 78 33 tp://ocsp.int-x3
02a0: 2e 6c 65 74 73 65 6e 63 72 79 70 74 2e 6f 72 67 .letsencrypt.org
02b0: 30 2f 06 08 2b 06 01 05 05 07 30 02 86 23 68 74 0/..+.....0..#ht
02c0: 74 70 3a 2f 2f 63 65 72 74 2e 69 6e 74 2d 78 33 tp://cert.int-x3
02d0: 2e 6c 65 74 73 65 6e 63 72 79 70 74 2e 6f 72 67 .letsencrypt.org
02e0: 2f 30 1d 06 03 55 1d 11 04 16 30 14 82 12 61 70 /0...U....0...ap
02f0: 70 2e 76 65 73 74 61 62 6f 61 72 64 2e 63 6f 6d p.vestaboard.com
0300: 30 4c 06 03 55 1d 20 04 45 30 43 30 08 06 06 67 0L..U. .E0C0...g
0310: 81 0c 01 02 01 30 37 06 0b 2b 06 01 04 01 82 df .....07..+......
0320: 13 01 01 01 30 28 30 26 06 08 2b 06 01 05 05 07 ....0(0&..+.....
0330: 02 01 16 1a 68 74 74 70 3a 2f 2f 63 70 73 2e 6c ....http://cps.l
0340: 65 74 73 65 6e 63 72 79 70 74 2e 6f 72 67 30 82 etsencrypt.org0.
0350: 01 04 06 0a 2b 06 01 04 01 d6 79 02 04 02 04 81 ....+.....y.....
0360: f5 04 81 f2 00 f0 00 76 00 74 7e da 83 31 ad 33 .......v.t~..1.3
0370: 10 91 21 9c ce 25 4f 42 70 c2 bf fd 5e 42 20 08 ..!..%OBp...^B .
0380: c6 37 35 79 e6 10 7b cc 56 00 00 01 68 47 c5 88 .75y..{.V...hG..
0390: 4f 00 00 04 03 00 47 30 45 02 20 4d bf e9 43 ae O.....G0E. M..C.
03a0: db 96 66 18 4f 46 8a 66 c7 24 4d 93 e4 16 8b b7 ..f.OF.f.$M.....
03b0: 29 23 01 5f 08 60 a5 13 d8 9a e1 02 21 00 be 25 )#._.`......!..%
03c0: 21 53 92 f5 ba 17 6b c6 63 06 b9 46 24 5e 05 7d !S....k.c..F$^.}
03d0: 73 2e 23 f9 f0 c5 c0 96 6c 1f d3 69 dc 31 00 76 s.#.....l..i.1.v
03e0: 00 63 f2 db cd e8 3b cc 2c cf 0b 72 84 27 57 6b .c....;.,..r.'Wk
03f0: 33 a4 8d 61 77 8f bd 75 a6 38 b1 c7 68 54 4b d8 3..aw..u.8..hTK.
0400: 8d 00 00 01 68 47 c5 88 3c 00 00 04 03 00 47 30 ....hG..<.....G0
0410: 45 02 21 00 ce f9 38 bc 77 7a 06 21 1e 6d 23 df E.!...8.wz.!.m#.
0420: e0 97 4f 69 49 a7 2b 71 7d 38 e0 1b 8a c6 92 71 ..OiI.+q}8.....q
0430: 08 2b 32 fd 02 20 28 50 c8 77 8d dd 78 69 8a 77 .+2.. (P.w..xi.w
0440: 3e d2 8e 30 a7 a1 43 41 ea 37 10 ab cf 34 3b 68 >..0..CA.7...4;h
0450: c2 bf a4 08 44 35 30 0d 06 09 2a 86 48 86 f7 0d ....D50...*.H...
0460: 01 01 0b 05 00 03 82 01 01 00 4c 6b 32 fa 48 b3 ..........Lk2.H.
0470: 4a 7c 37 a2 13 8f 50 f1 a0 31 c9 f6 97 37 00 ac J|7...P..1...7..
0480: 9d 7e 13 99 9c 7e 5d 4e af 6c 8b 56 12 c9 75 36 .~...~]N.l.V..u6
0490: 82 f4 16 05 c0 6c 40 58 c7 f2 f7 ea a4 4d 2a 6e .....l@X.....M*n
04a0: 30 64 48 1e 50 1a 83 7f b5 2c b8 62 4e 0b af 10 0dH.P...,.bN...
04b0: 60 64 1e f7 a7 53 df c0 78 88 38 f1 65 89 9c 1f `d...S..x.8.e...
04c0: 10 49 ed 1b 4b 24 dc 3f bc b2 a5 be d7 63 96 ab .I..K$.?.....c..
04d0: 02 62 ad 7e 82 87 5f 47 9e e1 53 9c 1d 43 2b b6 .b.~.._G..S..C+.
04e0: 7c 1e f5 28 13 b2 9e fe 1c d1 e2 1b 05 ec 36 b8 |..(..........6.
04f0: cc 90 8f 3e ac 51 bf 9f 0c af b8 d4 d7 bc 79 14 ...>.Q........y.
0500: 70 aa 37 a2 05 54 42 11 f4 a6 c1 d6 be 70 62 35 p.7..TB......pb5
0510: a8 ce cf 1f e2 82 13 bf a7 e0 42 3c 9c 93 f8 3f ..........B<...?
0520: 96 bc 4d d0 7d 44 6c e6 28 1d 0f 84 be 35 00 ae ..M.}Dl.(....5..
0530: aa 59 f0 eb eb f5 88 cc de 7e 3d 81 96 b2 18 88 .Y.......~=.....
0540: 55 6e c8 98 d8 3c 3f 10 2e 82 b5 2a b5 fc 8e 31 Un...<?....*...1
0550: f5 09 14 40 23 31 45 a7 86 87 81 75 9a 0f fa 87 ...@#1E....u....
0560: 03 ab 12 6d aa d9 36 8c 75 41 ...m..6.uA
=> Send SSL data, 5 bytes (0x5)
0000: 15 03 03 00 02 .....
== Info: TLSv1.2 (OUT), TLS alert, Server hello (2):
=> Send SSL data, 2 bytes (0x2)
0000: 02 30 .0
== Info: SSL certificate problem: unable to get local issuer certificate
== Info: Curl_http_done: called premature == 1
== Info: stopped the pause stream!
== Info: Closing connection 0

69
crc.py Normal file
View File

@@ -0,0 +1,69 @@
#!/usr/bin/env python
CRCTable = [
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d ]
def CRC32(array,sz=None):
if sz == None:
sz = len(array)
retval = 0xffffffff
for idx in range(sz):
b = array[idx]
n = (retval ^ b) & 0xff;
retval = (retval >> 8) ^ CRCTable[n]
retval = retval ^ 0xFFFFFFFF
return retval
def main():
print("CRC32[andrea] = %08x" % CRC32(bytes("andrea would like to test this.")))
if __name__ == '__main__':
main()

BIN
crc.pyc Normal file

Binary file not shown.

21
factory-config.py Normal file
View File

@@ -0,0 +1,21 @@
#!/bin/usr/env python
import time
import subprocess
import sys
import os
print 'Getting payload...'
sys.stdout.flush()
time.sleep(5)
print 'Configuring Vestaboard...'
sys.stdout.flush()
time.sleep(5)
print 'Writing...'
sys.stdout.flush()
with open("/home/pi/fg-test/stop-rainbow.sh", "a") as myfile:
myfile.write("python /home/pi/fg-test/factory-provision.py")
time.sleep(2)
print 'Rebooting...'
sys.stdout.flush()
os.system('sudo shutdown -r now')

180
factory-provision.py Normal file
View File

@@ -0,0 +1,180 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
def get_random_alphaNumeric_string(stringLength=6):
lettersAndDigits = string.ascii_letters + string.digits
return ''.join((random.choice(lettersAndDigits) for i in range(stringLength)))
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'Getting payload...'
#sys.stdout.flush()
#time.sleep(5)
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`0ALL`0you`0need`0is`0love`0', '`0`0`0`0and`0this`0code:`0`0`0`0', '`0`0`0`0`0`0`0`0'+get_random_alphaNumeric_string(6)+'`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0get`0app:`0`0`0`0`0`0`0', '`0`0vestaboard.com/app`0`0']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
#print 'Click \"Next Flap\" to continue.'
#sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

51
https-test.py Normal file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
#import requests
import urllib
import json
import sys
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
board_name = 'Testaboard'
firmware_version = 'Post update, pre AP'
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
try:
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
contents = page.read()
#conn = requests.get(full_url, verify=True)
#contents = conn.text
except httplib.ssl.SSLError as e:
print 'Error: ' + str(e)
sys.exit(-1)
#response = conn.getresponse()
#print response.status, response.reason
print page.getcode()
#conn.close()
page.close()
#return response
return contents
print('* * * * * * * * * *')
print ('Board:'), board_name, ('/ Firmware:'), firmware_version
print('* * * * * * * * * *')
r = get_board_content()
data = json.loads(r)
print data
ulines = data['message']['lines']
lines = [l.encode('ascii', 'ignore') for l in ulines]
print lines

173
initial-black.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
#print 'Click \"Next Flap\" to continue.'
#sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

70
initial-ping.py Normal file
View File

@@ -0,0 +1,70 @@
#!/usr/bin/env python
import serial
import serial.rs485
import time
import packet
import crc
import RPi.GPIO as GPIO
def read_reply(sport):
return sport.read(13)
def print_echo(s, count, before, after):
barr = bytearray(s)
print('Rx: %s' % (('STGT','xxxx', 'ARM ', 'GO ', 'PING')[barr[6]]) ),
for b in barr:
print(" %02x" % b),
print(" [%d src=%04x %1.3fms]" % (count, (ord(s[8])<<8)|ord(s[7]), (after-before)*1000))
def ping_packet(address):
return packet.ping(address)
def send_packet(sport, s):
sport.rts = False # Set high... logic inverted
sport.write([s[0]])
for c in s[1:]:
if c == 0xfe or c == 0xff:
print('escape')
sport.write([0xfe])
sport.write([c])
time.sleep(.01) # Delay
sport.rts = True # Set low... logic inverted
def main():
count = 0
#for b in packet_build(0x0001, 0x42, [0x04, 0xaa, 0x55]):
# print("%02x" % b)
#return
with serial.Serial('/dev/ttyAMA0', 38400) as ser:
ser.rts = False # setting it to high. The logic is negated. What a mess.
# ser.rs485_mode = serial.rs485.RS485Settings(rts_level_for_tx=True, rts_level_for_rx=False, loopback=False)
while True:
count += 1
# 22 col instead of 23 now
# XXX
for addr in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]:
before = time.clock()
packet.send(ser, ping_packet(addr))
s = read_reply(ser)
after = time.clock()
print_echo(s, count, before, after)
barr = bytearray(s)
crc_data = crc.CRC32(barr, len(barr)-4)
#for b in barr:
# print(" %02x" % b),
crc_rcvd = (barr[len(barr)-1] << 24) |(barr[len(barr)-2] << 16) | (barr[len(barr)-3] << 8) | (barr[len(barr)-4] << 0);
if (crc_rcvd != crc_data):
print(" [!CRC]"),
print("")
ser.flush()
time.sleep(.250)
break
if __name__ == '__main__':
main()

3
loop.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
while [ : ]; do ./test-counts.py > /dev/null; done

163
main-client.py Normal file
View File

@@ -0,0 +1,163 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vbctrl import *
import random
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
#board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
print 'before pause'
time.sleep(timeouts)
print 'after pause'
print 'before init_uart'
board_init_uart()
print 'after init_uart'
print 'before blanks'
# ANDREA
blanks()
print 'after blanks'
print 'before 2nd pause'
time.sleep(timeouts)
print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
while True:
while board_id == ' ':
print 'Fetching board id...'
print 'Board id inexistant! Please set board id, then reboot.'
time.sleep(5)
time.sleep(3)
print('**********')
print board_name
print('**********')
r = get_board_content()
data = json.loads(r)
#print('DATA: %s') % data
ulines = data['message']['lines']
#print('ulines: %s') % ulines
lines = [l.encode('ascii', 'ignore') for l in ulines]
print lines
row_num = len(lines)
print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
if row_len_flag == 0:
print('*** Jolly good! The message is OK to send to the board. ***')
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
last_lines = lines
print 'Waiting for bits to change...'
time.sleep(7)
print 'Fetching message...'

142
main-client.py.save Normal file
View File

@@ -0,0 +1,142 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vbctrl import *
import random
real_hw = True
def adjust_blanks(s):
blank = '░'
return s.replace('░','`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
retval = adjust_blanks(contents)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
# ANDREA
timeouts = 15
if real_hw:
print 'before pause'
time.sleep(timeouts)
print 'after pause'
print 'before init_uart'
board_init_uart()
print 'after init_uart'
print 'before blanks'
# ANDREA
blanks()
print 'after blanks'
print 'before 2nd pause'
time.sleep(timeouts)
print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
while True:
time.sleep(3)
r = get_board_content()
data = json.loads(r)
ulines = data['message']['lines']
lines = [l.encode('ascii', 'ignore') for l in ulines]
print lines
row_num = len(lines)
print('Number of rows: %d') % row_num
#for i in range(7):
# print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string)
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
if row_len_flag == 0:
print('Jolly good! The message is OK to send to the board.')
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
last_lines = lines

89
packet.py Normal file
View File

@@ -0,0 +1,89 @@
import crc
import serial
import time
OP_SET_TARGETS = 0x01
OP_ARM = 0x02
OP_GO = 0x03
OP_PING = 0x04
OP_REG_WRITE = 0x05
OP_REG_READ = 0x06
REG_INDEX_ADJUST = 0
REG_ROTATE_NOP = 1
REG_ONE_REV_MIN = 2
REG_REV_COUNT_0 = 3
REG_REV_COUNT_1 = 4
REG_REV_COUNT_2 = 5
REG_REV_COUNT_3 = 6
REG_REV_COUNT_4 = 7
REG_REV_COUNT_5 = 8
REG_REV_COUNT_6 = 9
REG_FREQ_D = 10
REG_FREQ_N = 11
REG_CRC_ERRORS = 12
REG_ZERO_NOISE = 13
def build(address, flags, payload, print_it=True):
packet_len = 1+2+1+2+len(payload)+4
b = bytearray(packet_len)
b[0] = 0xff
b[1] = address & 0xff
b[2] = address >> 8
b[3] = flags
b[4] = len(payload) & 0xff
b[5] = len(payload) >> 8
b[6:6+len(payload)] = payload
b[6+len(payload)+0] = 0xff
b[6+len(payload)+1] = 0xff
b[6+len(payload)+2] = 0xff
b[6+len(payload)+3] = 0xff
crc32 = crc.CRC32(b, packet_len - 4);
b[6+len(payload)+0] = (crc32 >> (0*8)) & 0xff
b[6+len(payload)+1] = (crc32 >> (1*8)) & 0xff
b[6+len(payload)+2] = (crc32 >> (2*8)) & 0xff
b[6+len(payload)+3] = (crc32 >> (3*8)) & 0xff
#if print_it:
#print('Tx: %s' % (('xxxx','STGT', 'ARM ', 'GO ', 'PING', 'REGW', 'REGR')[b[6]]) ),
#for bb in b:
#print(" %02x" % bb),
#print('')
return b
def ping(address, print_it=True):
return build(address, 0, [0x04, 0x00, 0x00], print_it)
def set_targets(address, targets, print_it=True):
payload = bytearray(8)
payload[0] = OP_SET_TARGETS
for i in range(len(payload)-1):
if i < len(targets):
payload[i+1] = targets[i]
else:
payload[i+1] = ' '
return build(address, 0, payload, print_it)
def arm(address, print_it=True):
return build(address, 0, [OP_ARM], print_it)
def go(address, print_it=True):
return build(address, 0, [OP_GO], print_it)
def reg_write(address, reg, val, print_it=True):
return build(address, 0, [OP_REG_WRITE, reg & 0xff, ((val>>8)&0xff), val & 0xff], print_it)
def reg_read(address, reg, print_it=True):
return build(address, 0, [OP_REG_READ, reg & 0xff], print_it)
def send(sport, s):
sport.rts = False # Set high... logic is inverted
sport.write([s[0]])
for c in s[1:]:
if c == 0xfe or c == 0xff:
sport.write([0xfe])
sport.write([c])
time.sleep(.01) # Delay
sport.rts = True # Set low... logic is inverted

BIN
packet.pyc Normal file

Binary file not shown.

19
paramiko-print.py Normal file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env python
import time
import sys
print 'Hello world! --> Python 2'
sys.stdout.flush()
print("Hello world! --> Python 3")
sys.stdout.flush()
time.sleep(1)
for i in range(5):
print '%d --> Python 2' % i
sys.stdout.flush()
print("%d --> Python 3") % i
sys.stdout.flush()
time.sleep(1)

7
stop-rainbow.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
python /home/pi/fg-test/initial-ping.py
sleep 1
python /home/pi/fg-test/initial-black.py
sleep 1
python /home/pi/fg-test/factory-provision.py

132
test-counts.py Normal file
View File

@@ -0,0 +1,132 @@
#!/usr/bin/env python
import serial
import serial.rs485
import sys
import time
import packet
def read_and_print(sport, print_it=True):
s = sport.read(6)
barr = bytearray(s)
ll = (barr[5]<<8) + barr[4]
s2 = sport.read(ll+4)
barr += bytearray(s2)
if print_it:
print('Rx:'),
for b in barr:
print(" %02x" % b),
print('')
return barr
def color_handling(s):
b = bytearray(s)
for idx in range(len(b)):
if chr(b[idx]) == '`':
b[idx+1] = int(chr(b[idx+1]))
s=b.translate(None,'`')
return s
def send_packet(s, print_it=True):
ser.rts = False # Set high... logic is inverted
ser.write([s[0]])
for c in s[1:]:
if c == 0xfe or c == 0xff:
if print_it:
print('escape')
ser.write([0xfe])
ser.write([c])
time.sleep(.005) # This delay seems to work...
ser.rts = True # Set low... logic is inverted
def test_setup_color (print_it):
string = '`1`1`1`1`1`1'
time.sleep(.5)
# 22 columns instead of 23 now
for c in [1, 2, 3, 16, 17, 18, 19, 20, 21, 22]:
#for c in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]:
#for c in [1, 2, 3, 4, 5, 6, 7, 8]:
s = color_handling(string)
# 6 rows instead of 7 now
val = ' '*(6-len(s))+s
send_packet(packet.set_targets(c, val, print_it))
read_and_print(ser, print_it)
send_packet(packet.arm(c, print_it))
read_and_print(ser, print_it)
def test_setup (string, print_it):
time.sleep(.5)
# 22 col instead of 23 now
for c in [1, 2, 3, 16, 17, 18, 19, 20, 21, 22]:
#for c in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]:
#for c in [1, 2, 3, 4, 5, 6, 7, 8]:
s = color_handling(string)
# 6 rows instead of 7 now
val = ' '*(6-len(s))+s
send_packet(packet.set_targets(c, val, print_it))
read_and_print(ser, print_it)
send_packet(packet.arm(c, print_it))
read_and_print(ser, print_it)
def go_all(string, print_it):
send_packet(packet.go(0x0001, print_it))
read_and_print(ser, print_it)
time.sleep(12)
# 22 rows instead of 23 now
for c in [1, 2, 3, 16, 17, 18, 19, 20, 21, 22]:
#for c in [1, 2, 3, 4, 5, 6, 7, 8]:
print('c#%d] ' % c),
# 6 rows instead of 7 now
for i in range(6):
send_packet(packet.reg_read(c, packet.REG_REV_COUNT_0+i, print_it))
res = read_and_print(ser, print_it)
count = (res[9]<<8)+res[8]
print('%d,' % count),
send_packet(packet.reg_read(c, packet.REG_ZERO_NOISE, print_it))
res = read_and_print(ser, print_it)
count = (res[9]<<8)+res[8]
print('z %d, ' % count),
print('%s,' % string)
def main(ser, args):
print_it = False
print "Initial setup..."
for c in [1, 2, 3, 16, 17, 18, 19, 20, 21, 22]:
#for c in [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]:
#for c in [1, 2, 3, 4, 5, 6, 7, 8]:
send_packet(packet.reg_write(c, packet.REG_INDEX_ADJUST, 20))
read_and_print(ser, print_it)
send_packet(packet.reg_write(c, packet.REG_ROTATE_NOP, 1))
read_and_print(ser, print_it)
send_packet(packet.reg_write(c, packet.REG_ONE_REV_MIN, 1))
read_and_print(ser, print_it)
send_packet(packet.reg_write(c, packet.REG_FREQ_D, 3))
read_and_print(ser, print_it)
###send_packet(packet.reg_write(c, packet.REG_FREQ_N, 6))
###read_and_print(ser, print_it)
print "done."
for c in 'zyxwvutsrqponmlkjihgfedcba'[::-1]:
print "Loop"
# 6 rows instead of 7 now
sval = c * 6
print "Setup..."
test_setup(sval, True)
#test_setup_color(False)
print "Setup done"
print "Go..."
go_all(sval, True)
print "Go Done"
if __name__ == '__main__':
tty = '/dev/ttyAMA0'
with serial.Serial(tty, 38400) as ser:
ser.rts = False # Setting it to high... the logic is inverted.
main(ser, sys.argv[1:])

179
test-flap-1.py Normal file
View File

@@ -0,0 +1,179 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
print 'before pause'
sys.stdout.flush()
#time.sleep(timeouts)
print 'after pause'
sys.stdout.flush()
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
print 'before blanks'
sys.stdout.flush()
# ANDREA
test_check_blanks()
print 'after blanks'
sys.stdout.flush()
print 'before 2nd pause'
sys.stdout.flush()
time.sleep(10)
print 'after 2nd pause'
sys.stdout.flush()
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-10.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['JJJJJJJJJJJJJJJJJJJJJJ', 'JJJJJJJJJJJJJJJJJJJJJJ', 'JJJJJJJJJJJJJJJJJJJJJJ', 'JJJJJJJJJJJJJJJJJJJJJJ', 'JJJJJJJJJJJJJJJJJJJJJJ', 'JJJJJJJJJJJJJJJJJJJJJJ']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-11.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
#time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['KKKKKKKKKKKKKKKKKKKKKK', 'KKKKKKKKKKKKKKKKKKKKKK', 'KKKKKKKKKKKKKKKKKKKKKK', 'KKKKKKKKKKKKKKKKKKKKKK', 'KKKKKKKKKKKKKKKKKKKKKK', 'KKKKKKKKKKKKKKKKKKKKKK']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-12.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
#time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['LLLLLLLLLLLLLLLLLLLLLL', 'LLLLLLLLLLLLLLLLLLLLLL', 'LLLLLLLLLLLLLLLLLLLLLL', 'LLLLLLLLLLLLLLLLLLLLLL', 'LLLLLLLLLLLLLLLLLLLLLL', 'LLLLLLLLLLLLLLLLLLLLLL']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-13.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['MMMMMMMMMMMMMMMMMMMMMM', 'MMMMMMMMMMMMMMMMMMMMMM', 'MMMMMMMMMMMMMMMMMMMMMM', 'MMMMMMMMMMMMMMMMMMMMMM', 'MMMMMMMMMMMMMMMMMMMMMM', 'MMMMMMMMMMMMMMMMMMMMMM']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-14.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['NNNNNNNNNNNNNNNNNNNNNN', 'NNNNNNNNNNNNNNNNNNNNNN', 'NNNNNNNNNNNNNNNNNNNNNN', 'NNNNNNNNNNNNNNNNNNNNNN', 'NNNNNNNNNNNNNNNNNNNNNN', 'NNNNNNNNNNNNNNNNNNNNNN']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-15.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['OOOOOOOOOOOOOOOOOOOOOO', 'OOOOOOOOOOOOOOOOOOOOOO', 'OOOOOOOOOOOOOOOOOOOOOO', 'OOOOOOOOOOOOOOOOOOOOOO', 'OOOOOOOOOOOOOOOOOOOOOO', 'OOOOOOOOOOOOOOOOOOOOOO']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-16.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['PPPPPPPPPPPPPPPPPPPPPP', 'PPPPPPPPPPPPPPPPPPPPPP', 'PPPPPPPPPPPPPPPPPPPPPP', 'PPPPPPPPPPPPPPPPPPPPPP', 'PPPPPPPPPPPPPPPPPPPPPP', 'PPPPPPPPPPPPPPPPPPPPPP']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-17.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['QQQQQQQQQQQQQQQQQQQQQQ', 'QQQQQQQQQQQQQQQQQQQQQQ', 'QQQQQQQQQQQQQQQQQQQQQQ', 'QQQQQQQQQQQQQQQQQQQQQQ', 'QQQQQQQQQQQQQQQQQQQQQQ', 'QQQQQQQQQQQQQQQQQQQQQQ']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-18.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['RRRRRRRRRRRRRRRRRRRRRR', 'RRRRRRRRRRRRRRRRRRRRRR', 'RRRRRRRRRRRRRRRRRRRRRR', 'RRRRRRRRRRRRRRRRRRRRRR', 'RRRRRRRRRRRRRRRRRRRRRR', 'RRRRRRRRRRRRRRRRRRRRRR']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-19.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['SSSSSSSSSSSSSSSSSSSSSS', 'SSSSSSSSSSSSSSSSSSSSSS', 'SSSSSSSSSSSSSSSSSSSSSS', 'SSSSSSSSSSSSSSSSSSSSSS', 'SSSSSSSSSSSSSSSSSSSSSS', 'SSSSSSSSSSSSSSSSSSSSSS']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-2.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
#time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['BBBBBBBBBBBBBBBBBBBBBB', 'BBBBBBBBBBBBBBBBBBBBBB', 'BBBBBBBBBBBBBBBBBBBBBB', 'BBBBBBBBBBBBBBBBBBBBBB', 'BBBBBBBBBBBBBBBBBBBBBB', 'BBBBBBBBBBBBBBBBBBBBBB']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-20.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['TTTTTTTTTTTTTTTTTTTTTT', 'TTTTTTTTTTTTTTTTTTTTTT', 'TTTTTTTTTTTTTTTTTTTTTT', 'TTTTTTTTTTTTTTTTTTTTTT', 'TTTTTTTTTTTTTTTTTTTTTT', 'TTTTTTTTTTTTTTTTTTTTTT']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-21.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['UUUUUUUUUUUUUUUUUUUUUU', 'UUUUUUUUUUUUUUUUUUUUUU', 'UUUUUUUUUUUUUUUUUUUUUU', 'UUUUUUUUUUUUUUUUUUUUUU', 'UUUUUUUUUUUUUUUUUUUUUU', 'UUUUUUUUUUUUUUUUUUUUUU']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-22.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['VVVVVVVVVVVVVVVVVVVVVV', 'VVVVVVVVVVVVVVVVVVVVVV', 'VVVVVVVVVVVVVVVVVVVVVV', 'VVVVVVVVVVVVVVVVVVVVVV', 'VVVVVVVVVVVVVVVVVVVVVV', 'VVVVVVVVVVVVVVVVVVVVVV']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-23.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['WWWWWWWWWWWWWWWWWWWWWW', 'WWWWWWWWWWWWWWWWWWWWWW', 'WWWWWWWWWWWWWWWWWWWWWW', 'WWWWWWWWWWWWWWWWWWWWWW', 'WWWWWWWWWWWWWWWWWWWWWW', 'WWWWWWWWWWWWWWWWWWWWWW']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-24.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['XXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-25.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['YYYYYYYYYYYYYYYYYYYYYY', 'YYYYYYYYYYYYYYYYYYYYYY', 'YYYYYYYYYYYYYYYYYYYYYY', 'YYYYYYYYYYYYYYYYYYYYYY', 'YYYYYYYYYYYYYYYYYYYYYY', 'YYYYYYYYYYYYYYYYYYYYYY']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-26.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['ZZZZZZZZZZZZZZZZZZZZZZ', 'ZZZZZZZZZZZZZZZZZZZZZZ', 'ZZZZZZZZZZZZZZZZZZZZZZ', 'ZZZZZZZZZZZZZZZZZZZZZZ', 'ZZZZZZZZZZZZZZZZZZZZZZ', 'ZZZZZZZZZZZZZZZZZZZZZZ']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-27.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['!!!!!!!!!!!!!!!!!!!!!!', '!!!!!!!!!!!!!!!!!!!!!!', '!!!!!!!!!!!!!!!!!!!!!!', '!!!!!!!!!!!!!!!!!!!!!!', '!!!!!!!!!!!!!!!!!!!!!!', '!!!!!!!!!!!!!!!!!!!!!!']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-28.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['@@@@@@@@@@@@@@@@@@@@@@', '@@@@@@@@@@@@@@@@@@@@@@', '@@@@@@@@@@@@@@@@@@@@@@', '@@@@@@@@@@@@@@@@@@@@@@', '@@@@@@@@@@@@@@@@@@@@@@', '@@@@@@@@@@@@@@@@@@@@@@']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-29.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['######################', '######################', '######################', '######################', '######################', '######################']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-3.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
#time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['CCCCCCCCCCCCCCCCCCCCCC', 'CCCCCCCCCCCCCCCCCCCCCC', 'CCCCCCCCCCCCCCCCCCCCCC', 'CCCCCCCCCCCCCCCCCCCCCC', 'CCCCCCCCCCCCCCCCCCCCCC', 'CCCCCCCCCCCCCCCCCCCCCC']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-30.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['$$$$$$$$$$$$$$$$$$$$$$', '$$$$$$$$$$$$$$$$$$$$$$', '$$$$$$$$$$$$$$$$$$$$$$', '$$$$$$$$$$$$$$$$$$$$$$', '$$$$$$$$$$$$$$$$$$$$$$', '$$$$$$$$$$$$$$$$$$$$$$']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-31.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['&&&&&&&&&&&&&&&&&&&&&&', '&&&&&&&&&&&&&&&&&&&&&&', '&&&&&&&&&&&&&&&&&&&&&&', '&&&&&&&&&&&&&&&&&&&&&&', '&&&&&&&&&&&&&&&&&&&&&&', '&&&&&&&&&&&&&&&&&&&&&&']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-32.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = [';;;;;;;;;;;;;;;;;;;;;;', ';;;;;;;;;;;;;;;;;;;;;;', ';;;;;;;;;;;;;;;;;;;;;;', ';;;;;;;;;;;;;;;;;;;;;;', ';;;;;;;;;;;;;;;;;;;;;;', ';;;;;;;;;;;;;;;;;;;;;;']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-33.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['((((((((((((((((((((((', '((((((((((((((((((((((', '((((((((((((((((((((((', '((((((((((((((((((((((', '((((((((((((((((((((((', '((((((((((((((((((((((']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-34.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['))))))))))))))))))))))', '))))))))))))))))))))))', '))))))))))))))))))))))', '))))))))))))))))))))))', '))))))))))))))))))))))', '))))))))))))))))))))))']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-35.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['----------------------', '----------------------', '----------------------', '----------------------', '----------------------', '----------------------']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-36.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['++++++++++++++++++++++', '++++++++++++++++++++++', '++++++++++++++++++++++', '++++++++++++++++++++++', '++++++++++++++++++++++', '++++++++++++++++++++++']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-37.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['======================', '======================', '======================', '======================', '======================', '======================']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-38.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['::::::::::::::::::::::', '::::::::::::::::::::::', '::::::::::::::::::::::', '::::::::::::::::::::::', '::::::::::::::::::::::', '::::::::::::::::::::::']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-39.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'', '\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'', '\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'', '\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'', '\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'', '\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-4.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
#time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['DDDDDDDDDDDDDDDDDDDDDD', 'DDDDDDDDDDDDDDDDDDDDDD', 'DDDDDDDDDDDDDDDDDDDDDD', 'DDDDDDDDDDDDDDDDDDDDDD', 'DDDDDDDDDDDDDDDDDDDDDD', 'DDDDDDDDDDDDDDDDDDDDDD']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-40.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"', '\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"', '\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"', '\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"', '\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"', '\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-41.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['%%%%%%%%%%%%%%%%%%%%%%', '%%%%%%%%%%%%%%%%%%%%%%', '%%%%%%%%%%%%%%%%%%%%%%', '%%%%%%%%%%%%%%%%%%%%%%', '%%%%%%%%%%%%%%%%%%%%%%', '%%%%%%%%%%%%%%%%%%%%%%']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-42.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = [',,,,,,,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,,,,,,']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-43.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['......................', '......................', '......................', '......................', '......................', '......................']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-44.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['??????????????????????', '??????????????????????', '??????????????????????', '??????????????????????', '??????????????????????', '??????????????????????']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-45.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8', '`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8', '`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8', '`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8', '`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8', '`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-46.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['//////////////////////', '//////////////////////', '//////////////////////', '//////////////////////', '//////////////////////', '//////////////////////']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-47.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['1111111111111111111111', '1111111111111111111111', '1111111111111111111111', '1111111111111111111111', '1111111111111111111111', '1111111111111111111111']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-48.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['2222222222222222222222', '2222222222222222222222', '2222222222222222222222', '2222222222222222222222', '2222222222222222222222', '2222222222222222222222']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-49.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['3333333333333333333333', '3333333333333333333333', '3333333333333333333333', '3333333333333333333333', '3333333333333333333333', '3333333333333333333333']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-5.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
#time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['EEEEEEEEEEEEEEEEEEEEEE', 'EEEEEEEEEEEEEEEEEEEEEE', 'EEEEEEEEEEEEEEEEEEEEEE', 'EEEEEEEEEEEEEEEEEEEEEE', 'EEEEEEEEEEEEEEEEEEEEEE', 'EEEEEEEEEEEEEEEEEEEEEE']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-50.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['4444444444444444444444', '4444444444444444444444', '4444444444444444444444', '4444444444444444444444', '4444444444444444444444', '4444444444444444444444']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-51.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['5555555555555555555555', '5555555555555555555555', '5555555555555555555555', '5555555555555555555555', '5555555555555555555555', '5555555555555555555555']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-52.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['6666666666666666666666', '6666666666666666666666', '6666666666666666666666', '6666666666666666666666', '6666666666666666666666', '6666666666666666666666']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-53.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['7777777777777777777777', '7777777777777777777777', '7777777777777777777777', '7777777777777777777777', '7777777777777777777777', '7777777777777777777777']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-54.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['8888888888888888888888', '8888888888888888888888', '8888888888888888888888', '8888888888888888888888', '8888888888888888888888', '8888888888888888888888']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-55.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['9999999999999999999999', '9999999999999999999999', '9999999999999999999999', '9999999999999999999999', '9999999999999999999999', '9999999999999999999999']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-56.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['0000000000000000000000', '0000000000000000000000', '0000000000000000000000', '0000000000000000000000', '0000000000000000000000', '0000000000000000000000']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-57.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-58.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1', '`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1', '`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1', '`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1', '`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1', '`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-59.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2', '`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2', '`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2', '`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2', '`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2', '`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-6.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
#time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['FFFFFFFFFFFFFFFFFFFFFF', 'FFFFFFFFFFFFFFFFFFFFFF', 'FFFFFFFFFFFFFFFFFFFFFF', 'FFFFFFFFFFFFFFFFFFFFFF', 'FFFFFFFFFFFFFFFFFFFFFF', 'FFFFFFFFFFFFFFFFFFFFFF']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-60.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3', '`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3', '`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3', '`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3', '`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3', '`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-61.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4', '`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4', '`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4', '`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4', '`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4', '`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-62.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5', '`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5', '`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5', '`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5', '`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5', '`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-63.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6', '`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6', '`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6', '`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6', '`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6', '`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-64.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Test complete.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-7.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['GGGGGGGGGGGGGGGGGGGGGG', 'GGGGGGGGGGGGGGGGGGGGGG', 'GGGGGGGGGGGGGGGGGGGGGG', 'GGGGGGGGGGGGGGGGGGGGGG', 'GGGGGGGGGGGGGGGGGGGGGG', 'GGGGGGGGGGGGGGGGGGGGGG']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-8.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['HHHHHHHHHHHHHHHHHHHHHH', 'HHHHHHHHHHHHHHHHHHHHHH', 'HHHHHHHHHHHHHHHHHHHHHH', 'HHHHHHHHHHHHHHHHHHHHHH', 'HHHHHHHHHHHHHHHHHHHHHH', 'HHHHHHHHHHHHHHHHHHHHHH']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

173
test-flap-9.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
# time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['IIIIIIIIIIIIIIIIIIIIII', 'IIIIIIIIIIIIIIIIIIIIII', 'IIIIIIIIIIIIIIIIIIIIII', 'IIIIIIIIIIIIIIIIIIIIII', 'IIIIIIIIIIIIIIIIIIIIII', 'IIIIIIIIIIIIIIIIIIIIII']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

359
test-flap-check.py Normal file
View File

@@ -0,0 +1,359 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
print 'before pause'
#time.sleep(timeouts)
print 'after pause'
print 'before init_uart'
board_init_uart()
print 'after init_uart'
print 'before blanks'
# ANDREA
test_check_blanks()
print 'after blanks'
print 'before 2nd pause'
time.sleep(10)
print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['', '', '', '', '', '']
line1 = ['AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA']
line2 = ['BBBBBBBBBBBBBBBBBBBBBB', 'BBBBBBBBBBBBBBBBBBBBBB', 'BBBBBBBBBBBBBBBBBBBBBB', 'BBBBBBBBBBBBBBBBBBBBBB', 'BBBBBBBBBBBBBBBBBBBBBB', 'BBBBBBBBBBBBBBBBBBBBBB']
line3 = ['CCCCCCCCCCCCCCCCCCCCCC', 'CCCCCCCCCCCCCCCCCCCCCC', 'CCCCCCCCCCCCCCCCCCCCCC', 'CCCCCCCCCCCCCCCCCCCCCC', 'CCCCCCCCCCCCCCCCCCCCCC', 'CCCCCCCCCCCCCCCCCCCCCC']
line4 = ['DDDDDDDDDDDDDDDDDDDDDD', 'DDDDDDDDDDDDDDDDDDDDDD', 'DDDDDDDDDDDDDDDDDDDDDD', 'DDDDDDDDDDDDDDDDDDDDDD', 'DDDDDDDDDDDDDDDDDDDDDD', 'DDDDDDDDDDDDDDDDDDDDDD']
line5 = ['EEEEEEEEEEEEEEEEEEEEEE', 'EEEEEEEEEEEEEEEEEEEEEE', 'EEEEEEEEEEEEEEEEEEEEEE', 'EEEEEEEEEEEEEEEEEEEEEE', 'EEEEEEEEEEEEEEEEEEEEEE', 'EEEEEEEEEEEEEEEEEEEEEE']
line6 = ['FFFFFFFFFFFFFFFFFFFFFF', 'FFFFFFFFFFFFFFFFFFFFFF', 'FFFFFFFFFFFFFFFFFFFFFF', 'FFFFFFFFFFFFFFFFFFFFFF', 'FFFFFFFFFFFFFFFFFFFFFF', 'FFFFFFFFFFFFFFFFFFFFFF']
line7 = ['GGGGGGGGGGGGGGGGGGGGGG', 'GGGGGGGGGGGGGGGGGGGGGG', 'GGGGGGGGGGGGGGGGGGGGGG', 'GGGGGGGGGGGGGGGGGGGGGG', 'GGGGGGGGGGGGGGGGGGGGGG', 'GGGGGGGGGGGGGGGGGGGGGG']
line8 = ['HHHHHHHHHHHHHHHHHHHHHH', 'HHHHHHHHHHHHHHHHHHHHHH', 'HHHHHHHHHHHHHHHHHHHHHH', 'HHHHHHHHHHHHHHHHHHHHHH', 'HHHHHHHHHHHHHHHHHHHHHH', 'HHHHHHHHHHHHHHHHHHHHHH']
line9 = ['IIIIIIIIIIIIIIIIIIIIII', 'IIIIIIIIIIIIIIIIIIIIII', 'IIIIIIIIIIIIIIIIIIIIII', 'IIIIIIIIIIIIIIIIIIIIII', 'IIIIIIIIIIIIIIIIIIIIII', 'IIIIIIIIIIIIIIIIIIIIII']
line10 = ['JJJJJJJJJJJJJJJJJJJJJJ', 'JJJJJJJJJJJJJJJJJJJJJJ', 'JJJJJJJJJJJJJJJJJJJJJJ', 'JJJJJJJJJJJJJJJJJJJJJJ', 'JJJJJJJJJJJJJJJJJJJJJJ', 'JJJJJJJJJJJJJJJJJJJJJJ']
line11 = ['KKKKKKKKKKKKKKKKKKKKKK', 'KKKKKKKKKKKKKKKKKKKKKK', 'KKKKKKKKKKKKKKKKKKKKKK', 'KKKKKKKKKKKKKKKKKKKKKK', 'KKKKKKKKKKKKKKKKKKKKKK', 'KKKKKKKKKKKKKKKKKKKKKK']
line12 = ['LLLLLLLLLLLLLLLLLLLLLL', 'LLLLLLLLLLLLLLLLLLLLLL', 'LLLLLLLLLLLLLLLLLLLLLL', 'LLLLLLLLLLLLLLLLLLLLLL', 'LLLLLLLLLLLLLLLLLLLLLL', 'LLLLLLLLLLLLLLLLLLLLLL']
line13 = ['MMMMMMMMMMMMMMMMMMMMMM', 'MMMMMMMMMMMMMMMMMMMMMM', 'MMMMMMMMMMMMMMMMMMMMMM', 'MMMMMMMMMMMMMMMMMMMMMM', 'MMMMMMMMMMMMMMMMMMMMMM', 'MMMMMMMMMMMMMMMMMMMMMM']
line14 = ['NNNNNNNNNNNNNNNNNNNNNN', 'NNNNNNNNNNNNNNNNNNNNNN', 'NNNNNNNNNNNNNNNNNNNNNN', 'NNNNNNNNNNNNNNNNNNNNNN', 'NNNNNNNNNNNNNNNNNNNNNN', 'NNNNNNNNNNNNNNNNNNNNNN']
line15 = ['OOOOOOOOOOOOOOOOOOOOOO', 'OOOOOOOOOOOOOOOOOOOOOO', 'OOOOOOOOOOOOOOOOOOOOOO', 'OOOOOOOOOOOOOOOOOOOOOO', 'OOOOOOOOOOOOOOOOOOOOOO', 'OOOOOOOOOOOOOOOOOOOOOO']
line16 = ['PPPPPPPPPPPPPPPPPPPPPP', 'PPPPPPPPPPPPPPPPPPPPPP', 'PPPPPPPPPPPPPPPPPPPPPP', 'PPPPPPPPPPPPPPPPPPPPPP', 'PPPPPPPPPPPPPPPPPPPPPP', 'PPPPPPPPPPPPPPPPPPPPPP']
line17 = ['QQQQQQQQQQQQQQQQQQQQQQ', 'QQQQQQQQQQQQQQQQQQQQQQ', 'QQQQQQQQQQQQQQQQQQQQQQ', 'QQQQQQQQQQQQQQQQQQQQQQ', 'QQQQQQQQQQQQQQQQQQQQQQ', 'QQQQQQQQQQQQQQQQQQQQQQ']
line18 = ['RRRRRRRRRRRRRRRRRRRRRR', 'RRRRRRRRRRRRRRRRRRRRRR', 'RRRRRRRRRRRRRRRRRRRRRR', 'RRRRRRRRRRRRRRRRRRRRRR', 'RRRRRRRRRRRRRRRRRRRRRR', 'RRRRRRRRRRRRRRRRRRRRRR']
line19 = ['SSSSSSSSSSSSSSSSSSSSSS', 'SSSSSSSSSSSSSSSSSSSSSS', 'SSSSSSSSSSSSSSSSSSSSSS', 'SSSSSSSSSSSSSSSSSSSSSS', 'SSSSSSSSSSSSSSSSSSSSSS', 'SSSSSSSSSSSSSSSSSSSSSS']
line20 = ['TTTTTTTTTTTTTTTTTTTTTT', 'TTTTTTTTTTTTTTTTTTTTTT', 'TTTTTTTTTTTTTTTTTTTTTT', 'TTTTTTTTTTTTTTTTTTTTTT', 'TTTTTTTTTTTTTTTTTTTTTT', 'TTTTTTTTTTTTTTTTTTTTTT']
line21 = ['UUUUUUUUUUUUUUUUUUUUUU', 'UUUUUUUUUUUUUUUUUUUUUU', 'UUUUUUUUUUUUUUUUUUUUUU', 'UUUUUUUUUUUUUUUUUUUUUU', 'UUUUUUUUUUUUUUUUUUUUUU', 'UUUUUUUUUUUUUUUUUUUUUU']
line22 = ['VVVVVVVVVVVVVVVVVVVVVV', 'VVVVVVVVVVVVVVVVVVVVVV', 'VVVVVVVVVVVVVVVVVVVVVV', 'VVVVVVVVVVVVVVVVVVVVVV', 'VVVVVVVVVVVVVVVVVVVVVV', 'VVVVVVVVVVVVVVVVVVVVVV']
line23 = ['WWWWWWWWWWWWWWWWWWWWWW', 'WWWWWWWWWWWWWWWWWWWWWW', 'WWWWWWWWWWWWWWWWWWWWWW', 'WWWWWWWWWWWWWWWWWWWWWW', 'WWWWWWWWWWWWWWWWWWWWWW', 'WWWWWWWWWWWWWWWWWWWWWW']
line24 = ['XXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX']
line25 = ['YYYYYYYYYYYYYYYYYYYYYY', 'YYYYYYYYYYYYYYYYYYYYYY', 'YYYYYYYYYYYYYYYYYYYYYY', 'YYYYYYYYYYYYYYYYYYYYYY', 'YYYYYYYYYYYYYYYYYYYYYY', 'YYYYYYYYYYYYYYYYYYYYYY']
line26 = ['ZZZZZZZZZZZZZZZZZZZZZZ', 'ZZZZZZZZZZZZZZZZZZZZZZ', 'ZZZZZZZZZZZZZZZZZZZZZZ', 'ZZZZZZZZZZZZZZZZZZZZZZ', 'ZZZZZZZZZZZZZZZZZZZZZZ', 'ZZZZZZZZZZZZZZZZZZZZZZ']
line27 = ['!!!!!!!!!!!!!!!!!!!!!!', '!!!!!!!!!!!!!!!!!!!!!!', '!!!!!!!!!!!!!!!!!!!!!!', '!!!!!!!!!!!!!!!!!!!!!!', '!!!!!!!!!!!!!!!!!!!!!!', '!!!!!!!!!!!!!!!!!!!!!!']
line28 = ['@@@@@@@@@@@@@@@@@@@@@@', '@@@@@@@@@@@@@@@@@@@@@@', '@@@@@@@@@@@@@@@@@@@@@@', '@@@@@@@@@@@@@@@@@@@@@@', '@@@@@@@@@@@@@@@@@@@@@@', '@@@@@@@@@@@@@@@@@@@@@@']
line29 = ['######################', '######################', '######################', '######################', '######################', '######################']
line30 = ['$$$$$$$$$$$$$$$$$$$$$$', '$$$$$$$$$$$$$$$$$$$$$$', '$$$$$$$$$$$$$$$$$$$$$$', '$$$$$$$$$$$$$$$$$$$$$$', '$$$$$$$$$$$$$$$$$$$$$$', '$$$$$$$$$$$$$$$$$$$$$$']
line31 = ['&&&&&&&&&&&&&&&&&&&&&&', '&&&&&&&&&&&&&&&&&&&&&&', '&&&&&&&&&&&&&&&&&&&&&&', '&&&&&&&&&&&&&&&&&&&&&&', '&&&&&&&&&&&&&&&&&&&&&&', '&&&&&&&&&&&&&&&&&&&&&&']
line32 = [';;;;;;;;;;;;;;;;;;;;;;', ';;;;;;;;;;;;;;;;;;;;;;', ';;;;;;;;;;;;;;;;;;;;;;', ';;;;;;;;;;;;;;;;;;;;;;', ';;;;;;;;;;;;;;;;;;;;;;', ';;;;;;;;;;;;;;;;;;;;;;']
line33 = ['((((((((((((((((((((((', '((((((((((((((((((((((', '((((((((((((((((((((((', '((((((((((((((((((((((', '((((((((((((((((((((((', '((((((((((((((((((((((']
line34 = ['))))))))))))))))))))))', '))))))))))))))))))))))', '))))))))))))))))))))))', '))))))))))))))))))))))', '))))))))))))))))))))))', '))))))))))))))))))))))']
line35 = ['----------------------', '----------------------', '----------------------', '----------------------', '----------------------', '----------------------']
line36 = ['++++++++++++++++++++++', '++++++++++++++++++++++', '++++++++++++++++++++++', '++++++++++++++++++++++', '++++++++++++++++++++++', '++++++++++++++++++++++']
line37 = ['======================', '======================', '======================', '======================', '======================', '======================']
line38 = ['::::::::::::::::::::::', '::::::::::::::::::::::', '::::::::::::::::::::::', '::::::::::::::::::::::', '::::::::::::::::::::::', '::::::::::::::::::::::']
line39 = ['\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'', '\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'', '\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'', '\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'', '\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'', '\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'']
line40 = ['\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"', '\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"', '\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"', '\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"', '\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"', '\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"']
line41 = ['%%%%%%%%%%%%%%%%%%%%%%', '%%%%%%%%%%%%%%%%%%%%%%', '%%%%%%%%%%%%%%%%%%%%%%', '%%%%%%%%%%%%%%%%%%%%%%', '%%%%%%%%%%%%%%%%%%%%%%', '%%%%%%%%%%%%%%%%%%%%%%']
line42 = [',,,,,,,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,,,,,,']
line43 = ['......................', '......................', '......................', '......................', '......................', '......................']
line44 = ['??????????????????????', '??????????????????????', '??????????????????????', '??????????????????????', '??????????????????????', '??????????????????????']
line45 = ['`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8', '`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8', '`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8', '`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8', '`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8', '`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8`8']
line46 = ['//////////////////////', '//////////////////////', '//////////////////////', '//////////////////////', '//////////////////////', '//////////////////////']
line47 = ['1111111111111111111111', '1111111111111111111111', '1111111111111111111111', '1111111111111111111111', '1111111111111111111111', '1111111111111111111111']
line48 = ['2222222222222222222222', '2222222222222222222222', '2222222222222222222222', '2222222222222222222222', '2222222222222222222222', '2222222222222222222222']
line49 = ['3333333333333333333333', '3333333333333333333333', '3333333333333333333333', '3333333333333333333333', '3333333333333333333333', '3333333333333333333333']
line50 = ['4444444444444444444444', '4444444444444444444444', '4444444444444444444444', '4444444444444444444444', '4444444444444444444444', '4444444444444444444444']
line51 = ['5555555555555555555555', '5555555555555555555555', '5555555555555555555555', '5555555555555555555555', '5555555555555555555555', '5555555555555555555555']
line52 = ['6666666666666666666666', '6666666666666666666666', '6666666666666666666666', '6666666666666666666666', '6666666666666666666666', '6666666666666666666666']
line53 = ['7777777777777777777777', '7777777777777777777777', '7777777777777777777777', '7777777777777777777777', '7777777777777777777777', '7777777777777777777777']
line54 = ['8888888888888888888888', '8888888888888888888888', '8888888888888888888888', '8888888888888888888888', '8888888888888888888888', '8888888888888888888888']
line55 = ['9999999999999999999999', '9999999999999999999999', '9999999999999999999999', '9999999999999999999999', '9999999999999999999999', '9999999999999999999999']
line56 = ['0000000000000000000000', '0000000000000000000000', '0000000000000000000000', '0000000000000000000000', '0000000000000000000000', '0000000000000000000000']
line57 = ['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0']
line58 = ['`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1', '`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1', '`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1', '`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1', '`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1', '`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1']
line59 = ['`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2', '`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2', '`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2', '`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2', '`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2', '`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2`2']
line60 = ['`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3', '`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3', '`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3', '`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3', '`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3', '`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3`3']
line61 = ['`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4', '`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4', '`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4', '`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4', '`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4', '`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4`4']
line62 = ['`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5', '`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5', '`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5', '`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5', '`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5', '`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5`5']
line63 = ['`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6', '`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6', '`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6', '`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6', '`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6', '`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6`6']
line64 = ['`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7']
test_flag = 0
for i in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64]:
if i == 1:
lines = line1
if i == 2:
lines = line2
if i == 3:
lines = line3
if i == 4:
lines = line4
if i == 5:
lines = line5
if i == 6:
lines = line6
if i == 7:
lines = line7
if i == 8:
lines = line8
if i == 9:
lines = line9
if i == 10:
lines = line10
if i == 11:
lines = line11
if i == 12:
lines = line12
if i == 13:
lines = line13
if i == 14:
lines = line14
if i == 15:
lines = line15
if i == 16:
lines = line16
if i == 17:
lines = line17
if i == 18:
lines = line18
if i == 19:
lines = line19
if i == 20:
lines = line20
if i == 21:
lines = line21
if i == 22:
lines = line22
if i == 23:
lines = line23
if i == 24:
lines = line24
if i == 25:
lines = line25
if i == 26:
lines = line26
if i == 27:
lines = line27
if i == 28:
lines = line28
if i == 29:
lines = line29
if i == 30:
lines = line30
if i == 31:
lines = line31
if i == 32:
lines = line32
if i == 33:
lines = line33
if i == 34:
lines = line34
if i == 35:
lines = line35
if i == 36:
lines = line36
if i == 37:
lines = line37
if i == 38:
lines = line38
if i == 39:
lines = line39
if i == 40:
lines = line40
if i == 41:
lines = line41
if i == 42:
lines = line42
if i == 43:
lines = line43
if i == 44:
lines = line44
if i == 45:
lines = line45
if i == 46:
lines = line46
if i == 47:
lines = line47
if i == 48:
lines = line48
if i == 49:
lines = line49
if i == 50:
lines = line50
if i == 51:
lines = line51
if i == 52:
lines = line52
if i == 53:
lines = line53
if i == 54:
lines = line54
if i == 55:
lines = line55
if i == 56:
lines = line56
if i == 57:
lines = line57
if i == 58:
lines = line58
if i == 59:
lines = line59
if i == 60:
lines = line60
if i == 61:
lines = line61
if i == 62:
lines = line62
if i == 63:
lines = line63
if i == 64:
lines = line64
print lines
row_num = len(lines)
print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
print('*** TEST PASSED ***')
setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! The message is OK to send to the board. ***')
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
last_lines = lines
print 'Waiting for bits to change...'
time.sleep(5)
print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")
input("Press Enter to continue...")

4
test-flap-complete.py Normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print("Test complete.")

173
test-flap-first-letter.py Normal file
View File

@@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#time.sleep(timeouts)
#print 'after pause'
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
#print 'before blanks'
# ANDREA
#test_check_blanks()
#print 'after blanks'
#print 'before 2nd pause'
#time.sleep(1)
#print 'after 2nd pause'
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
#time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAA']
test_flag = 0
print lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
print('* * * * * ')
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
if row_len_flag == 0:
print('*** Jolly good! Message format valid. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(6)
print 'Click \"Next Flap\" to continue.'
sys.stdout.flush()
#print 'Done. Please click "Next Flap" to continue.'
#raw_input("Press Enter to continue...")

181
test-long-msg.py Normal file
View File

@@ -0,0 +1,181 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
sys.stdout.flush()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#sys.stdout.flush()
#time.sleep(timeouts)
#print 'after pause'
sys.stdout.flush()
print 'before init_uart'
sys.stdout.flush()
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
print 'before blanks'
sys.stdout.flush()
# ANDREA
test_long_blanks()
print 'after blanks'
sys.stdout.flush()
print 'before 2nd pause'
sys.stdout.flush()
time.sleep(10)
print 'after 2nd pause'
sys.stdout.flush()
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '`ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ']
print "\nMessage sent to Vestaboard: %s\n" % lines
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#sys.stdout.flush()
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
print('* * * * * ')
sys.stdout.flush()
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
lines_b = ['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0TEST`0STATUS:`0`0`0`0`0', '`0`0`0`0`0`0`0`0PASSED`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0']
#print('* * * * * ')
print('Too many characters in row %d --> Not sending to Vestaboard.') % (i+1)
#print('* * * * * ')
sys.stdout.flush()
#print('\n*** TEST PASSED IF NO MESSAGE IS PRINTED ON BOARD ***\n')
sys.stdout.flush()
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)
print("\nTest success!")
sys.stdout.flush()
if row_len_flag == 0:
print('*** Jolly good! The message is OK to send to the board. ***')
sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
print 'after setup digits'
sys.stdout.flush()
last_lines = lines

70
test-ping.py Normal file
View File

@@ -0,0 +1,70 @@
#!/usr/bin/env python
import serial
import serial.rs485
import time
import packet
import crc
import RPi.GPIO as GPIO
def read_reply(sport):
return sport.read(13)
def print_echo(s, count, before, after):
barr = bytearray(s)
print('Rx: %s' % (('STGT','xxxx', 'ARM ', 'GO ', 'PING')[barr[6]]) ),
for b in barr:
print(" %02x" % b),
print(" [%d src=%04x %1.3fms]" % (count, (ord(s[8])<<8)|ord(s[7]), (after-before)*1000))
def ping_packet(address):
return packet.ping(address)
def send_packet(sport, s):
sport.rts = False # Set high... logic inverted
sport.write([s[0]])
for c in s[1:]:
if c == 0xfe or c == 0xff:
print('escape')
sport.write([0xfe])
sport.write([c])
time.sleep(.01) # Delay
sport.rts = True # Set low... logic inverted
def main():
count = 0
#for b in packet_build(0x0001, 0x42, [0x04, 0xaa, 0x55]):
# print("%02x" % b)
#return
with serial.Serial('/dev/ttyAMA0', 38400) as ser:
ser.rts = False # setting it to high. The logic is negated. What a mess.
# ser.rs485_mode = serial.rs485.RS485Settings(rts_level_for_tx=True, rts_level_for_rx=False, loopback=False)
while True:
count += 1
# 22 col instead of 23 now
# XXX
for addr in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]:
#for addr in [1, 2, 3, 4, 5, 6, 7, 8]:
before = time.clock()
packet.send(ser, ping_packet(addr))
s = read_reply(ser)
after = time.clock()
print_echo(s, count, before, after)
barr = bytearray(s)
crc_data = crc.CRC32(barr, len(barr)-4)
#for b in barr:
# print(" %02x" % b),
crc_rcvd = (barr[len(barr)-1] << 24) |(barr[len(barr)-2] << 16) | (barr[len(barr)-3] << 8) | (barr[len(barr)-4] << 0);
if (crc_rcvd != crc_data):
print(" [!CRC]"),
print("")
ser.flush()
time.sleep(.250)
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,210 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
import json
from vestactrl import *
import random
import sys
real_hw = True
def adjust_blanks(s):
blank = ''
return s.replace('','`0')
def adjust_empty_spaces(s):
empty_space = ' '
return s.replace(' ', '`0')
def get_board_content():
url1 = 'https://app.vestaboard.com/api/v1/board/'
url2 = '/describe'
full_url = url1 + board_id + url2
page = urllib.urlopen(full_url)
#conn = httplib.HTTPSConnection('app.vestaboard.com')
#conn.request('GET', '/api/v1/board/%s/describe' % board_id)
#response = conn.getresponse()
contents = page.read()
#print response.status, response.reason
print page.getcode()
sys.stdout.flush()
#retval = adjust_blanks(response.read())
contents2 = adjust_blanks(contents)
retval = adjust_empty_spaces(contents2)
#conn.close()
page.close()
return retval
def is_new_content(new, old):
retval = False
for v in zip(new,old):
if v[0] != v[1]:
retval = True
break
return retval
def random_colors():
proto = [
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d',
'`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d`%d']
lines = []
for p in proto:
s = p % (random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5),
random.randint(1, 5))
lines.append(s)
setup_digits(lines, left_to_right_swap=False)
# VBR (23x7)
#board_id = '700df57c-8b0a-4166-8758-b9de6e900cb8'
# VB (22x6)
#board_id = 'demo-a3c6ed9d-0499-4368-a3e9-b132cfc94305'
# Testaboard
board_id = 'demo-6a439bfd-fe37-4d82-af76-9cbf4fbd6367'
#board_id = ' '
board_name = 'Testaboard'
# ANDREA
timeouts = 15
if real_hw:
#print 'before pause'
#sys.stdout.flush()
#time.sleep(timeouts)
#print 'after pause'
#sys.stdout.flush()
print 'before init_uart'
board_init_uart()
print 'after init_uart'
sys.stdout.flush()
print 'before blanks'
sys.stdout.flush()
# ANDREA
test_rapid_blanks()
print 'after blanks'
sys.stdout.flush()
print 'before 2nd pause'
sys.stdout.flush()
time.sleep(10)
print 'after 2nd pause'
sys.stdout.flush()
print '\n3 messages sent to queue: \'ABCDE\', \'FGHIJ\', \'KLMNO\''
last_lines = ['', '', '', '', '', '']
data = None
#while True:
#while board_id == ' ':
#time.sleep(5)
time.sleep(3)
#print('**********')
#print board_name
#print('**********')
#r = get_board_content()
#data = json.loads(r)
#print('DATA: %s') % data
#ulines = data['message']['lines']
#print('ulines: %s') % ulines
#lines = [l.encode('ascii', 'ignore') for l in ulines]
lines = ['', '', '', '', '', '']
line1 = ['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0ABCDE`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0']
line2 = ['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0FGHIJ`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0']
line3 = ['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0KLMNO`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0']
test_flag = 0
msg = ' '
msg1 = 'ABDCE'
msg2 = 'FGHIJ'
msg3 = 'KLMNO'
for i in [1, 2, 3]:
if i == 1:
lines = line1
msg = msg1
if i == 2:
lines = line2
msg = msg2
if i == 3:
lines = line3
msg = msg3
#print lines
print '\nMessage displayed: %s' % msg
sys.stdout.flush()
row_num = len(lines)
#print('Number of rows: %d') % row_num
#sys.stdout.flush()
#for i in range(6):
#print('%s || %s' %(lines[i], last_lines[i]))
if row_num > 6:
print('* * * * * ')
sys.stdout.flush()
print('ERROR: Too many rows; cannot send your message to the board. Sorry!')
sys.stdout.flush()
print('* * * * * ')
sys.stdout.flush()
if row_num < 7:
row_len_flag = 0
for i in range(row_num):
row_string = lines[i]
#print('CURRENT ROW STRING: %s') % row_string
row_len = len(row_string) - row_string.count('`')
#print('CURRENT ROW LENGTH: %s') % row_len
if row_len > 22:
row_len_flag = 1
print('* * * * * ')
sys.stdout.flush()
print('ERROR: Too many characters in row %d; cannot send your message to the board. Sorry!') % i
sys.stdout.flush()
print('* * * * * ')
sys.stdout.flush()
if row_len_flag == 0:
#print('*** Jolly good! The message is OK to send to the board. ***')
#sys.stdout.flush()
if lines and is_new_content(lines, last_lines):
#if lines != last_lines:
print 'before setup digits'
sys.stdout.flush()
# ANDREA
setup_digits(lines, left_to_right_swap=False, real_hw=real_hw)
#sys.stdout.flush()
print 'after setup digits'
sys.stdout.flush()
last_lines = lines
print 'Waiting for bits to change...'
sys.stdout.flush()
time.sleep(15)
#print 'Fetching message...'
#sys.stdout.flush()
test_flag = test_flag + 1
#print test_flag
if test_flag == 3:
#lines_b = ['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0TEST`0STATUS:`0`0`0`0`0', '`0`0`0`0`0`0`0`0PASSED`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0']
#print('*** TEST PASSED IF ALL THREE MESSAGES DISPLAYED CORRECTLY***')
print '\nTest success!'
sys.stdout.flush()
#setup_digits(lines_b, left_to_right_swap=False, real_hw=real_hw)

30
test-rssi.py Normal file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env python
import re
import time
import sys
import os
import subprocess
signal = 0
avg = 0
freq = 5
for i in range(freq):
time.sleep(1)
line = subprocess.check_output(["echo $(/sbin/iwconfig wlan0 | grep Signal)"], shell=True)
sys.stdout.flush()
try:
found = re.search('Signal level=(.+?) dBm', line).group(1)
signal += int(found)
except AttributeError:
# Value not found...
print("Value not found. Stopping test.")
exit()
print found
sys.stdout.flush()
avg = (signal/freq)
print("Average:")
print(avg)
sys.stdout.flush()

16
test-rssi.sh Normal file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
signal=""
level=""
avg=""
for i in {1..5}
do
signal=$(echo "$(iwconfig wlan0 | grep Signal)" | sed -e 's/^.*Signal level=\(.*\) dBm/\1/')
printf "Signal: $signal"
level=$((level+signal))
#echo $level
sleep 1
done
avg=$((level/5))
echo "Average:" $avg

4
test-wrong-entry.py Normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print("Ivalid entry. Please try again.")

228
vestactrl.py Normal file
View File

@@ -0,0 +1,228 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import serial
import serial.rs485
import sys
import time
import packet
import string
ser = None
def read_and_print(sport, print_it=False):
s = sport.read(6)
barr = bytearray(s)
ll = (barr[5]<<8) + barr[4]
s2 = sport.read(ll+4)
barr += bytearray(s2)
#if print_it:
#print('Rx:'),
#for b in barr:
#print(" %02x" % b),
#print('')
return barr
def color_handling(s):
b = bytearray(s)
for idx in range(len(b)):
if chr(b[idx]) == '`':
b[idx+1] = int(chr(b[idx+1]))
s=b.translate(None,'`')
return s
def send_packet(s):
ser.rts = False # Set high... logic is inverted
ser.write([s[0]])
for c in s[1:]:
if c == 0xfe or c == 0xff:
#print('escape')
ser.write([0xfe])
ser.write([c])
time.sleep(.005) # Delay
ser.rts = True # Set low... logic is inverted
def test (string, print_it):
time.sleep(.5)
s = color_handling(string)
# 6 rows instead of 7 now
val = ' '*(6-len(s))+s
send_packet(packet.set_targets(0x0001, val, print_it))
read_and_print(ser, print_it)
send_packet(packet.arm(0x0001, print_it))
read_and_print(ser, print_it)
send_packet(packet.go(0x0001, print_it))
read_and_print(ser, print_it)
time.sleep(12)
# 6 rows insteaad of 7 now
for i in range(6):
send_packet(packet.reg_read(0x0001, packet.REG_REV_COUNT_0+i, print_it))
res = read_and_print(ser, print_it)
count = (res[9]<<8)+res[8]
#print('%d,' % count),
#print('%s,' % string)
# 22 col instead of 23 now
all_columns = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
#all_columns = [1, 2, 3, 4, 5, 6, 7, 8]
def init_all_columns():
for c in all_columns:
send_packet(packet.reg_write(c, packet.REG_INDEX_ADJUST, 20))
read_and_print(ser)
send_packet(packet.reg_write(c, packet.REG_ROTATE_NOP, 0))
read_and_print(ser)
send_packet(packet.reg_write(c, packet.REG_ONE_REV_MIN, 0))
read_and_print(ser)
#send_packet(packet.reg_write(c, packet.REG_FREQ_D, 5))
#read_and_print(ser)
#send_packet(packet.reg_write(c, packet.REG_FREQ_N, 2))
#read_and_print(ser)
def print_board(rows,print_it=True):
if print_it:
print('#'*24)
for l in rows:
# 22 col insteaed of 23 now
print '#' + ('%-22s' % l) + '#'
print('#'*24)
for l in rows:
print " ".join("{:02x}".format(ord(c)) for c in l)
def setup_digits(strings, left_to_right_swap = False, real_hw=True):
#print('string sent in app: %s') % strings
#print('string length: %d') % len(strings)
print_it = True
# digits raw major
# 22 col instead of 23 and 6 rows instead of now
#drm = ['\x00'*22, '\x00'*22, '\x00'*22, '\x00'*22, '\x00'*22, '\x00'*22]
drm = [' '*22, ' '*22, ' '*22, ' '*22, ' '*22, ' '*22]
# 6 rows instead of 7 now
offset = (6-len(strings))/2
max_len = 0
for idx in range(len(strings)):
s = strings[idx]
# 22 col instaed of 23 now
s = color_handling(s)[:22]
if left_to_right_swap:
s = s[::-1]
if len(s) > max_len:
max_len = len(s)
# 22 col insteaad of 23 now
drm[offset+idx] = ('%-22s' % s)
#print_board(drm)
#print('Length of DRM: %d') % len(drm)
for idx in range(len(drm)):
#print('IDX: %d') % idx
initial_length = len(drm[idx])
whitespace_number = drm[idx].count(' ')
final_length = initial_length - whitespace_number
left_side = (22-final_length)/2
#print('left side: %d') % left_side
right_side = 22 - left_side - final_length
#print('right side: %d') % right_side
# 22 col instead of 23 now
drm[idx] = drm[idx].replace(' ', '')
drm[idx] = ('%-22s' % (('\x00'*(left_side)) + drm[idx] + ('\x00'*(right_side))))[:22]
#print 'Rows: %d' % len(drm)
#print 'Max Len: %d' % max_len
#print_board(drm)
# 6 row instead of 7 now
while len(drm) < 6:
# 22 col insteaad of 23 now
drm.append('%-22s' % '\x00')
# digits column major
dcm = []
# 6 row instead of 7 now
tups = zip(drm[0], drm[1], drm[2], drm[3], drm[4], drm[5])
#tups = zip(drm[0])
for t in tups:
dcm.append(''.join(t))
#print('tups: %s') % tups
if real_hw:
for idx in range(len(all_columns)):
#print 'idx: %d' % idx
#print '>>>> [%d] %s' % (idx+1, dcm[idx][::-1])
##############################################################################################
send_packet(packet.set_targets(idx+1, dcm[idx][::-1], print_it))
read_and_print(ser, print_it)
send_packet(packet.arm(idx+1, print_it))
read_and_print(ser, print_it)
send_packet(packet.go(0x0001, print_it))
read_and_print(ser, print_it)
#print('skipping stuff...')
##############################################################################################
#else:
#print tups
def emc_blanks():
setup_digits(['`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7', '`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7`7'], left_to_right_swap=True)
def blanks():
#for c in all_columns:
# send_packet(packet.reg_write(c, packet.REG_FREQ_D, 8))
# read_and_print(ser)
# send_packet(packet.reg_write(c, packet.REG_FREQ_N, 2))
# read_and_print(ser)
setup_digits(['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0'], left_to_right_swap=True)
#setup_digits(['', '', '', '', '', ''], left_to_right_swap=True)
def test_long_blanks():
#for c in all_columns:
# send_packet(packet.reg_write(c, packet.REG_FREQ_D, 8))
# read_and_print(ser)
# send_packet(packet.reg_write(c, packet.REG_FREQ_N, 2))
# read_and_print(ser)
setup_digits(['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0TEST`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0LONG`0MESSAGE`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0'], left_to_right_swap=False)
#setup_digits(['', '', '', '', '', ''], left_to_right_swap=True)
def test_rapid_blanks():
#for c in all_columns:
# send_packet(packet.reg_write(c, packet.REG_FREQ_D, 8))
# read_and_print(ser)
# send_packet(packet.reg_write(c, packet.REG_FREQ_N, 2))
# read_and_print(ser)
setup_digits(['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0TSET`0`0`0`0`0`0`0`0`0', '`0`0`0NOISSECCUS`0DIPAR`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0'], left_to_right_swap=True)
#setup_digits(['', '', '', '', '', ''], left_to_right_swap=True)
def test_check_blanks():
#for c in all_columns:
# send_packet(packet.reg_write(c, packet.REG_FREQ_D, 8))
# read_and_print(ser)
# send_packet(packet.reg_write(c, packet.REG_FREQ_N, 2))
# read_and_print(ser)
setup_digits(['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0TSET`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0KCEHC`0PALF`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0'], left_to_right_swap=True)
#setup_digits(['', '', '', '', '', ''], left_to_right_swap=True)
def test_power_blanks():
setup_digits(['`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0TSET`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0WARD`0REWOP`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0', '`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0'], left_to_right_swap=True)
def board_init_uart():
global ser
#tty = '/dev/ttyUSB0'
tty = '/dev/ttyAMA0'
ser = serial.Serial(tty, 38400)
#def main(ser, args):
# init_all_columns()
#
# blanks()
# time.sleep(15)
# setup_digits(['vestaboard', 'welcome to', 't', 'e', 's', 't', '#'], left_to_right_swap=True)
# time.sleep(15)
# setup_digits(['colors `1`2`3', '`4`5`6 samples', '', '', '', '', ''], left_to_right_swap=True)
# time.sleep(15)
# setup_digits(['`0`1`2`3`4`5`6`5`4`3`2`1', '`6`5`4`3`2`1`0`1`2`3`4`5', '', '', '', '', ''], left_to_right_swap=True)
# time.sleep(15)
# blanks()
#
#if __name__ == '__main__':
# tty = '/dev/ttyUSB0'
# with serial.Serial(tty, 38400) as ser:
# main(ser, sys.argv[1:])

BIN
vestactrl.pyc Normal file

Binary file not shown.

3
write-to-rc.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
sudo sed -i '/^sleep 2/a python /home/pi/fg-test/factory-provision.py' /home/pi/fg-test/stop-rainbow.sh