 System.usbDiskModeActivate()

font = Font.load("Geek a byte 2.ttf")
font:setPixelSizes(25,30)

Adhoc_state = 0
Adhoc.init()

Bild = Image.load("1.jpg")


rot = Color.new(255,0,0)
blau = Color.new(0,0,255)
weiss = Color.new(255,255,255)

battr = System.powerGetBatteryLifePercent()




current = 1
oldpad = Controls.read()
while true do 
screen:clear()
screen:blit(0,0,Bild,true)

pad = Controls.read()
    
    
    screen:fontPrint(font,90,100,"Test Adhoc",blau)
	screen:fontPrint(font,90,240,"End",blau)
	
	
	if current == 1 then
    screen:fontPrint(font,90,100,"Test Adhoc",rot)
    end
    if current == 2 then
    screen:fontPrint(font,90,240,"End",rot)
    end

	if pad:up() and oldpad:up() ~= pad:up() then
    current = current - 1
    end
    if pad:down() and oldpad:down() ~= pad:down() then
    current = current + 1
    end

	Adhoc_state = Adhoc.getState()
-- Adhoc_state = 1
    if Adhoc_state == 0 then
	state = "Uninitialized"
    else
	state = "Initialized"
	screen:fontPrint(font,100,190, "The Adhoc is working!", rot)
    end
	
	
	screen:fontPrint(font,100,170, "The Adhoc is " .. state, weiss)
     -- IF-Befehle --
     

	
    if pad:cross() and current == 1 then
    Adhoc.connect()
    end
    
    	
	if pad:cross() and current == 2 then
    dofile("LUATool.lua")
    end
   
    
    if current == 3 then
    current = 1
    end
    if current == 0 then
    current = 2
    end


screen:print(300, 10, "Batterie-Status:", weiss)
screen:print(440, 10, battr, rot)
screen:print(460, 10, "%", weiss)



screen.waitVblankStart( )
screen.flip()
end