This is my first project in codea and the ipad and i think the controls i made turned out neat and ust felt like sharing
--main
supportedOrientations(PORTRAIT)
function grossWeightChanged()
grossWeight.value=math.floor(grossWeight.value/100)*100
grossWeightLabel.txt="GW: "..tostring(grossWeight.value)
end
function pressureAltitudeChanged()
pressureAltitude.value=math.floor(pressureAltitude.value/100)*100
pressureAltitudeLabel.txt="PA: "..tostring(pressureAltitude.value)
end
function tempChanged()
temperature.value=math.floor(temperature.value)
temperatureLabel.txt="Temp: "..tostring(temperature.value)
end
function calc()
sound(DATA, "ZgBAOzllf2h4f39AAAAAAAAAAADf/Qo+AABzf3JiYkB/f0AA")
pa=pressureAltitude.value
temp=temperature.value
tempF=temp*1.8+32
gw=grossWeight.value
isa=pa/500+temp-15
da=math.ceil((pa+120*isa)/500)*500--need to get more accurate formula
isaLabel.txt="ISA: "..isa
densityAltitudeLabel.txt="DA: "..da
end
function setup()
displayMode(FULLSCREEN)
grossWeight=Slider(497,980,260,38000,53000,44000,grossWeightChanged)
grossWeightLabel=LabelC(445,980,"GW: ",color(0, 0, 0, 255))
pressureAltitude=Slider(497,940,260,0,9000,4300,pressureAltitudeChanged)
pressureAltitudeLabel=LabelC(445,940,"PA: ",color(0, 0, 0, 255))
temperature=Slider(497,900,260,0,50,20,tempChanged)
temperatureLabel=LabelC(445,900,"Temp: ",color(0, 0, 0, 255))
isaLabel=LabelC(55,980,"ISA: ",color(0,60,0,255))
densityAltitudeLabel=LabelC(55,940,"DA: ",color(0,60,0,255))
calc=Button(334,835,90,40,"Calculate",calc)
end
function draw()
background(194, 197, 207, 255)
drawControls()
end
function touched(touch)
touchControls(touch)
end