Quote:
Originally Posted by ChronosHD
Is the pageturnd code available? I would experiment with it, my touchscreen is dead, so I´m looking for a workaround to still use the kindle somehow.
|
I still couldn't find my pageturnd sourcecode, I think it is on a VM but I am not sure which one.
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