|
|
#16 | |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 645
Karma: 1888888
Join Date: Jun 2009
Device: prs-505, Kindle Keyboard 3g, PW3
|
Quote:
I did find the ESP8266 wifi code that I used as the remote control, in order to skip running a hotspot on my phone. This is running an an adafruit feather ESP8266 wifi board, with two buttons: Code:
wifiConfig = {}
-- wifi.STATION -- station: join a WiFi network
-- wifi.SOFTAP -- access point: create a WiFi network
-- wifi.wifi.STATIONAP -- both station and access point
wifiConfig.mode = wifi.SOFTAP -- both station and access point
wifiConfig.accessPointConfig = {}
wifiConfig.accessPointConfig.ssid = "KNDL" -- Name o f the SSID you want to create
wifiConfig.accessPointConfig.pwd = "32165498" -- WiFi password - at least 8 c haracters
wifiConfig.accessPointIpConfig = {}
wifiConfig.accessPointIpConfig.ip = "192.168.111.1"
wifiConfig.accessPointIpConfig.netmask = "255.255.255.0"
wifiConfig.accessPointIpConfig.gateway = "192.168.111.1"
wifi.setmode(wifiConfig.mode)
print('set (mode='..wifi.getmode()..')')
if (wifiConfig.mode == wifi.SOFTAP) or (wifiConfig.mode == wifi.STATIONAP) then
print('AP MAC: ',wifi.ap.getmac())
wifi.ap.config(wifiConfig.accessPointConfig)
wifi.ap.setip(wifiConfig.accessPointIpConfig)
end
print('chip: ',node.chipid())
print('heap: ',node.heap())
wifiConfig = nil
collectgarbage()
-- End WiFi configuration
function pageTurn(command)
conn = nil
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload)
print(payload)
end)
-- when connected, request page (send parameters to a script)
conn:on("connection", function(conn, payload)
print('\nConnected')
conn:send(command)
end)
-- when disconnected, let it be known
conn:on("disconnection", function(conn, payload)
print('\nDisconnected')
end)
conn:connect(5001,'192.168.111.57')
end
function pageBack()
pageTurn("R")
end
function pageForward()
pageTurn("L")
end
do
-- use pin 3 as the input pulse width counter
local pin3, pin4, pulse1, du, now, trig = 3, 4, 0, 0, tmr.now, gpio.trig
gpio.mode(pin3,gpio.INT)
gpio.mode(pin4,gpio.INT)
local function pincb(pin, level)
trig(pin, "none")
local pulse2 = now()
print( pin, level, gpio.HIGH, level == gpio.HIGH,level == gpio.HIGH and "do wn" or "up", "down", "up", pulse2 - pulse1 )
pulse1 = pulse2
if (pin == pin3) and ( level == gpio.HIGH ) then
pageBack()
end
if (pin == pin4) and ( level == gpio.HIGH ) then
pageForward()
end
trig(pin, level == gpio.HIGH and "down" or "up")
end
trig(pin3, "down", function(level) pincb(pin3, level) end)
trig(pin4, "down", function(level) pincb(pin4, level) end)
end
|
|
|
|
|
|
|
#17 |
|
Addict
![]() Posts: 319
Karma: 26
Join Date: Jul 2012
Device: Kindle Paperwhite 4 (2018)
|
so how did the remote work physically? I see the esd which just looks like a chip. Would this work with koreader ?
|
|
|
|
| Advert | |
|
|
|
|
#18 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 645
Karma: 1888888
Join Date: Jun 2009
Device: prs-505, Kindle Keyboard 3g, PW3
|
Image attached, It is wired up to two buttons.
|
|
|
|
![]() |
| Tags |
| cross-compile, pageturnd |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Remote Page Turning Controller | frostschutz | Kobo Developer's Corner | 45 | 08-25-2020 12:49 PM |
| Page turning remote / App wanted | jskvbinmv | Kindle Developer's Corner | 16 | 09-11-2014 12:35 PM |
| Paperwhite Page Count Method | marcl | Amazon Kindle | 5 | 10-09-2013 11:44 AM |
| PRS-600 How is battery life affected by turn off method | Dave W | Sony Reader | 5 | 10-13-2009 11:45 PM |
| Automatic page turn / remote Working Prototype | gregcd | Sony Reader | 5 | 09-14-2009 07:38 PM |