Pi Webserver to Arduino

Just want to hang out with other Makers and chat about stuff? This is the place to do it.
DaveMark
Posts: 56
Joined: Sat Sep 20, 2014 11:10 am

Re: Pi Webserver to Arduino

Post by DaveMark » Fri Aug 19, 2016 11:18 pm

Good thanks, I know it's LAMP, but is P for PHP or Python in your case?

Are you programming in PHP or Python, or other?

keiranwyllie
Posts: 40
Joined: Tue Aug 16, 2016 9:17 am

Re: Pi Webserver to Arduino

Post by keiranwyllie » Sat Aug 20, 2016 7:44 am

Only using html at the moment. The code is over here: viewtopic.php?f=4&t=6648

I've just used the sketch example for the 8 channel relay shield.

DaveMark
Posts: 56
Joined: Sat Sep 20, 2014 11:10 am

Re: Pi Webserver to Arduino

Post by DaveMark » Sat Aug 20, 2016 9:23 am

You are painting a very confusing picture here...

The link you provide has Arduino code not HTML, but more so if you are talking running two computing like devices such as a Pi and an Arduino you are talking TWO different sets of programming languages.

a. Arduino typically via Arduino IDE a Java like language.

b. Raspberry Pi typically when running LAMP (Linux, Apache, MySQL and a P language) is running PHP^^, but could be Perl or Python.

https://en.wikipedia.org/wiki/LAMP_(software_bundle)

Hence my question, although I did forget Perl!

So I need to know for your Raspberry Pi LAMP setup is it Perl, PHP, or Python?

If you don't know then it leaves this thread cold.

BTW...

What state/city are you in?

Do you visit any other forums for assistance on these matters?


^^ This forum site uses PHP, hence phpBB.

keiranwyllie
Posts: 40
Joined: Tue Aug 16, 2016 9:17 am

Re: Pi Webserver to Arduino

Post by keiranwyllie » Sat Aug 20, 2016 11:31 am

Sorry, I meant this part of the sketch was html

Code: Select all

    /* store the HTML in program memory using the P macro */
    P(message) = 
      "<html><head><title>16 Channel Test</title>"
      "<body style='background-color:powderblue;'>"
      "<form action='/control' method='POST'>"
      "<h1 style='color:red;font-family:comic sans ms;font-size:200%;text-align:center;'>16 Channel Test</h1><hr>"
      "<div style='float:left;width:60%;'>"
      "<p style='font-size:140%;'><button style='height:40px;width:75px' type='submit' name='On' value='1'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='1'>Off</button>1<button style='height:40px;width:75px' type='submit' name='On' value='2'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='2'>Off</button>2</p>"
      "<p style='font-size:140%;'><button style='height:40px;width:75px' type='submit' name='On' value='3'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='3'>Off</button>3<button style='height:40px;width:75px' type='submit' name='On' value='4'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='4'>Off</button>4</p>"
      "<p style='font-size:140%;'><button style='height:40px;width:75px' type='submit' name='On' value='5'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='5'>Off</button>5<button style='height:40px;width:75px' type='submit' name='On' value='6'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='6'>Off</button>6</p>"
      "<p style='font-size:140%;'><button style='height:40px;width:75px' type='submit' name='On' value='7'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='7'>Off</button>7<button style='height:40px;width:75px' type='submit' name='On' value='8'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='8'>Off</button>8</p>"
      "<p style='font-size:140%;'><button style='height:40px;width:75px' type='submit' name='On' value='9'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='9'>Off</button>9<button style='height:40px;width:75px' type='submit' name='On' value='10'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='10'>Off</button>10</p>"
      "<p style='font-size:140%;'><button style='height:40px;width:75px' type='submit' name='On' value='11'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='11'>Off</button>11<button style='height:40px;width:75px' type='submit' name='On' value='12'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='12'>Off</button>12</p>"
      "<p style='font-size:140%;'><button style='height:40px;width:75px' type='submit' name='On' value='13'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='13'>Off</button>13<button style='height:40px;width:75px' type='submit' name='On' value='14'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='14'>Off</button>14</p>"
      "<p style='font-size:140%;'><button style='height:40px;width:75px' type='submit' name='On' value='15'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='15'>Off</button>15<button style='height:40px;width:75px' type='submit' name='On' value='16'>On</button><button style='height:40px;width:75px' type='submit' name='Off' value='16'>Off</button>16</p>"
      "<p style='font-size:140%;text-align:center;'><button style='height:40px;width:75px' type='submit' name='AllOff' value='0'>Off</button>&nbsp&nbspTurn Everything Off</p></div>"
      "</form>"
      "</body></html>";

My Raspberry Pi is using php.

I'm in the Newcastle area and no I haven't posted this on any other forums as yet. I've been trying to research a lot of this myself. As it is I've hit a bit of a hurdle with implementing a momentary switch in the mix but that's another problem lol

DaveMark
Posts: 56
Joined: Sat Sep 20, 2014 11:10 am

Re: Pi Webserver to Arduino

Post by DaveMark » Sat Aug 20, 2016 12:03 pm

I hope I am not getting confused myself, as either you are still confused, or how you are writing this is confusing.

A Sketch implies Arduino, not Pi LAMP, so what the heck is the HTML doing on the Arduino?

A typical Arduino does not have a User Interface like a Pi does, but of course there are exceptions.

Are you telling me your Arduino Sketch is an exception in some way?

The typical case use is Arduino as device controller, interfacing with a Pi for human interaction.

Do you have some exception to this case use I am not aware of?

keiranwyllie
Posts: 40
Joined: Tue Aug 16, 2016 9:17 am

Re: Pi Webserver to Arduino

Post by keiranwyllie » Sun Aug 21, 2016 8:15 am

All I've done is use the example that Jon has shown in this video from SuperHouse https://www.youtube.com/watch?v=jvuvyiyVqtc

Only modified the html a little bit to make it look nicer.

keiranwyllie
Posts: 40
Joined: Tue Aug 16, 2016 9:17 am

Re: Pi Webserver to Arduino

Post by keiranwyllie » Tue Aug 23, 2016 7:13 am

All good, I've moved the webpage across to my Pi and added the following to the html:

Code: Select all

<form action="http://10.0.0.100/control" target="dummyframe" method="POST">

<iframe width="0" height="0" border="0" name="dummyframe" id="dummyframe"></iframe>
This works great now.
Last edited by keiranwyllie on Tue Aug 23, 2016 9:02 am, edited 1 time in total.

DaveMark
Posts: 56
Joined: Sat Sep 20, 2014 11:10 am

Re: Pi Webserver to Arduino

Post by DaveMark » Tue Aug 23, 2016 7:46 am

None of this makes sense.

Me thinks you are leaving out some aspects.

keiranwyllie
Posts: 40
Joined: Tue Aug 16, 2016 9:17 am

Re: Pi Webserver to Arduino

Post by keiranwyllie » Tue Aug 23, 2016 9:06 am

I don't think it's that difficult to understand, it should be pretty simple (pic attached). I added the lines above to my html on my Pi (the HTML that was formally running on the arduino as its own webserver) and it's working.

Code: Select all

<html><head><title>16 Channel Test</title>
  <body style="background-color:powderblue;">
    <form action="http://10.0.0.100/control" target="dummyframe" method="POST">
    <h1 style="color:red;font-family:comic sans ms;font-size:200%;text-align:center;">16 Channel Test</h1><hr>
    <div style="float:left;width:60%;">
      <p style="font-size:140%;"><button style="height:40px;width:75px" type="submit" name="On" value="1">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="1">Off</button>1<button style="height:40px;width:75px" type="submit" name="On" value="2">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="2">Off</button>2</p>
      <p style="font-size:140%;"><button style="height:40px;width:75px" type="submit" name="On" value="3">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="3">Off</button>3<button style="height:40px;width:75px" type="submit" name="On" value="4">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="4">Off</button>4</p>
      <p style="font-size:140%;"><button style="height:40px;width:75px" type="submit" name="On" value="5">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="5">Off</button>5<button style="height:40px;width:75px" type="submit" name="On" value="6">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="6">Off</button>6</p>
      <p style="font-size:140%;"><button style="height:40px;width:75px" type="submit" name="On" value="7">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="7">Off</button>7<button style="height:40px;width:75px" type="submit" name="On" value="8">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="8">Off</button>8</p>
      <p style="font-size:140%;"><button style="height:40px;width:75px" type="submit" name="On" value="9">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="9">Off</button>9<button style="height:40px;width:75px" type="submit" name="On" value="10">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="10">Off</button>10</p>
      <p style="font-size:140%;"><button style="height:40px;width:75px" type="submit" name="On" value="11">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="11">Off</button>11<button style="height:40px;width:75px" type="submit" name="On" value="12">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="12">Off</button>12</p>
      <p style="font-size:140%;"><button style="height:40px;width:75px" type="submit" name="On" value="13">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="13">Off</button>13<button style="height:40px;width:75px" type="submit" name="On" value="14">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="14">Off</button>14</p>
      <p style="font-size:140%;"><button style="height:40px;width:75px" type="submit" name="On" value="15">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="15">Off</button>15<button style="height:40px;width:75px" type="submit" name="On" value="16">On</button><button style="height:40px;width:75px" type="submit" name="Off" value="16">Off</button>16</p>
      <p style="font-size:140%;text-align:center;"><button style="height:40px;width:75px" type="submit" name="AllOff" value="0">Off</button>&nbsp&nbspTurn Everything Off</p></div>
    </form>
        <iframe width="0" height="0" border="0" name="dummyframe" id="dummyframe"></iframe>
  </body>
</html>
Attachments
piarduino.jpg

DaveMark
Posts: 56
Joined: Sat Sep 20, 2014 11:10 am

Re: Pi Webserver to Arduino

Post by DaveMark » Tue Aug 23, 2016 9:16 am

No sorry, that's still just too simplistic, it still doesn't add up.

I should just clarify that I have over 30+ years of computer experience, including Web technologies, and furthermore I also check with a highly experienced friend, and we both agree that something is being left out of this equation.

That video link you gave before does not provide direct access to ANY source code/files to assist us.

Post Reply