-1

I have got Arduino Mega 2560, Arduino WiFi Shield and resistor 1.5K.

Now PWM 2 is attached to the resistor then attached GND. 5V is attached between PWM2 and resistor's up point. I want to read the Arduino Mega's A7 analog input point in order to print this value on an Android Phone's web browser but, I get zero value every time surprisingly. It should be like 235, 350 something like integer or float kinds as usual.

According to Android Phone's Google Chrome Web Browser Page, why there are too many zeros in the HTML? It should be different from zeros because I have already added a short wire to Analog A7 so as to make an antenna.

A photo of my setup:

My workside

Screenshot of my Android web browser

Android Phone Screen

Serial Monitor output

Arduino IDE & Serial Monitor

My code:

#include <SPI.h>
#include <WiFi.h>

char ssid[] = "Connectify-me";      
char pass[] = "***";    
int status = WL_IDLE_STATUS;
float PPG = analogRead(A7);
boolean door_status = false;
WiFiServer server(80);
void setup() {
  Serial.begin(9600);
  while ( status != WL_CONNECTED) { 
    Serial.print("Yazdigin SSID araniyor: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, pass);
    delay(10000);
  } 
  server.begin();
  printWifiStatus();
}
void loop() {       
  WiFiClient client = server.available();
  if (client) {
    Serial.println("Deger gonderildi");
    Serial.print(PPG);
    while (client.connected() & client.available()) {
          client.println("<html>");
          client.println("<body>");
          client.println("<li>");
          client.print(PPG);  //The value should different from zeros but everytime 0
          client.println("</li>");
          client.println("<br />");
          client.println("</body>");
          client.println("</html>");
      }
    }
    delay(3000);
      client.stop();
      Serial.println("client disonnected");
  }
  void printWifiStatus() {
  Serial.print("Baglandigimiz SSID: ");
  Serial.println(WiFi.SSID());
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Addressi browserda ac: ");
  Serial.println(ip);
  long rssi = WiFi.RSSI();
}
  • 4
    Step 1 in troubleshooting is to create a minimal example. The Serial.print(PPG); shows 0, so all the web server stuff is irrelevant. You need to narrow your scope to isolate the problem. – sachleen Apr 27 '14 at 0:38
  • 1
    Use images that add information to you question. A screendump of the code and a screendump from 0-values doesn't add to the information, it even distracts. A proper circuit diagram would normally be welcome, but after analyzing your writing and the picture I concluded that all this question is about, is a dangling wire. Don't put up a smoke screen, as sachleen mentioned, it is very important to narrow down to what you actually want to know and that is not limited to minimal code to reproduce the issue. It took me several minutes (and considering to leave the question unanswered) to understand – jippie Apr 27 '14 at 16:24
2

The capacitor in the sample-and-hold circuit in the ADC frontend is tied to ground and it is very leaky. Unless you have a low or medium impedance output connected to it, you will always read the ground value. An antenna is a very high impedance device.

2

You are reading the input pin float PPG = analogRead(A7); only in the startup code of your program. Move that into the loop to have it updated before using it.

  • Yes, I have already did this. Still, not a remedy for me. – Bay Apr 27 '14 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.