<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IoT and ESPcopter with Processing 3 &#8211; ESPcopter</title>
	<atom:link href="https://espcopter.com/category/iot-and-espcopter-with-processing-3/feed/" rel="self" type="application/rss+xml" />
	<link>https://espcopter.com</link>
	<description>ESPcopter</description>
	<lastBuildDate>Tue, 27 Nov 2018 20:24:21 +0000</lastBuildDate>
	<language>tr</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://espcopter.com/wp-content/uploads/2016/09/cropped-quad-1-32x32.jpg</url>
	<title>IoT and ESPcopter with Processing 3 &#8211; ESPcopter</title>
	<link>https://espcopter.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Motor Speed Control With Processing</title>
		<link>https://espcopter.com/2018/11/27/motor-speed-control-with-processing/</link>
					<comments>https://espcopter.com/2018/11/27/motor-speed-control-with-processing/#respond</comments>
		
		<dc:creator><![CDATA[metehanemlik]]></dc:creator>
		<pubDate>Tue, 27 Nov 2018 20:13:00 +0000</pubDate>
				<category><![CDATA[IoT and ESPcopter with Processing 3]]></category>
		<guid isPermaLink="false">http://espcopter.com/?p=1126</guid>

					<description><![CDATA[Screenshot Arduino Code: #include const char WiFiAPPSK[] = ""; WiFiServer server(80); #define blueLed 16 #define redLed 2 #define greenLed 0 [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Screenshot</h1>
<h1><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-1127" src="http://espcopter.com/wp-content/uploads/2018/11/pro3.png" alt="" width="506" height="536" srcset="https://espcopter.com/wp-content/uploads/2018/11/pro3.png 506w, https://espcopter.com/wp-content/uploads/2018/11/pro3-350x371.png 350w, https://espcopter.com/wp-content/uploads/2018/11/pro3-283x300.png 283w" sizes="(max-width: 506px) 100vw, 506px" /></h1>
<h1></h1>
<h1>Arduino Code:</h1>
<pre class="">#include 

const char WiFiAPPSK[] = "";
WiFiServer server(80);

#define blueLed 16
#define redLed 2
#define greenLed 0

int red = 0, green = 0, blue = 0;
int pinPWM[4] = {14, 15, 12, 13}; //Define PWM pin
int throttle = 0; 
String strial;
String inString = ""; 
int currentColor = 0;
void setup() {
  Serial.begin(9600);
 analogWriteFreq(20000); 
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(blueLed, OUTPUT);
  
  pinMode(pinPWM[0], OUTPUT);
  pinMode(pinPWM[1], OUTPUT);
  pinMode(pinPWM[2], OUTPUT);
  pinMode(pinPWM[3], OUTPUT);
  
 setupWiFi();

}

void loop() {
WiFiClient client = server.available();
 Serial.println("waiting... ");

  Serial.println(client);
  if (client ) {
    while (client.connected()) {
      while(1){
      if (client.available()) {
   
        int inChar;
        inChar = client.read();

  if (isDigit(inChar)) {
    // convert the incoming byte to a char 
    // and add it to the string:
    inString += (char)inChar; 
  }

   if (inChar == '*') {
    // do something different for each value of currentColor:
    switch (currentColor) {
      case 0:    // 0 = red
        red = inString.toInt();
        // clear the string for new input:
        inString = "";
        break;
      case 1:    // 1 = green:
        green = inString.toInt();
        // clear the string for new input:
        inString = "";
        break;
    }
    currentColor++;
  }
  // if you get a newline, you know you've got
  // the last color, i.e. blue:
  if (inChar == '?') {
    throttle = inString.toInt();
    // clear the string for new input:
    inString = "";
    // reset the color counter:
    currentColor = 0;
  }
    }

  
     analogWrite(pinPWM[0], throttle);
     analogWrite(pinPWM[1], throttle);
     analogWrite(pinPWM[2], throttle);
     analogWrite(pinPWM[3], throttle);

   
    }

   // Serial.println("Client disconnected.");
   // client.stop();
 } 

 }
}


void setupWiFi(){
  WiFi.mode(WIFI_AP);

  // Do a little work to get a unique-ish name. Append the
  // last two bytes of the MAC (HEX'd) to "Thing-":
  uint8_t mac[WL_MAC_ADDR_LENGTH];
  WiFi.softAPmacAddress(mac);
  String macID = String(mac[WL_MAC_ADDR_LENGTH - 2], HEX) +
                 String(mac[WL_MAC_ADDR_LENGTH - 1], HEX);
  macID.toUpperCase();
  String AP_NameString = "ESPCopter";

  char AP_NameChar[AP_NameString.length() + 1];
  memset(AP_NameChar, 0, AP_NameString.length() + 1);

  for (int i=0; i&lt;AP_NameString.length(); i++)
    AP_NameChar[i] = AP_NameString.charAt(i);

   WiFi.softAP(AP_NameChar, WiFiAPPSK);

   server.begin();
}
</pre>
<h1>Processing Code:</h1>
<pre class="">import processing.net.*; 
import controlP5.*;
Client myClient; 
ControlP5 cp5;
Knob myKnobA;
String command= "";

void setup() {
   size(500, 500,P3D);
   background(0);
    myClient = new Client(this, "192.168.4.1", 80); 
   println(myClient.ip());  
     cp5 = new ControlP5(this);
  myKnobA = cp5.addKnob("knobValue")
               .setRange(0,100)
               .setValue(0)
               .setPosition(200,200)
               .setRadius(50)
               .setNumberOfTickMarks(50)
               .setTickMarkLength(4)
               .snapToTickMarks(true)
               .setColorForeground(color(255))
               .setColorBackground(color(0, 160, 100))
               .setColorActive(color(255,255,0))
               .setDragDirection(Knob.HORIZONTAL)
               ;
    
}

 void draw() {

 


 
 }

void knobValue(int theValue) {
  println("a knob event. "+theValue);
  command =  0+ "*" + 0+ "*" + theValue + "?" ;
    myClient.write(command);
 
}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://espcopter.com/2018/11/27/motor-speed-control-with-processing/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>RGB LED Control with Processing</title>
		<link>https://espcopter.com/2018/11/27/rgb-led-control-with-processing/</link>
					<comments>https://espcopter.com/2018/11/27/rgb-led-control-with-processing/#respond</comments>
		
		<dc:creator><![CDATA[metehanemlik]]></dc:creator>
		<pubDate>Tue, 27 Nov 2018 20:05:54 +0000</pubDate>
				<category><![CDATA[IoT and ESPcopter with Processing 3]]></category>
		<guid isPermaLink="false">http://espcopter.com/?p=1123</guid>

					<description><![CDATA[Screenshot Arduino Code #include const char WiFiAPPSK[] = ""; WiFiServer server(80); #define blueLed 16 #define redLed 2 #define greenLed 0 [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Screenshot</h1>
<h1><img decoding="async" class="alignnone size-full wp-image-1124" src="http://espcopter.com/wp-content/uploads/2018/11/pro2.png" alt="" width="502" height="504" srcset="https://espcopter.com/wp-content/uploads/2018/11/pro2.png 502w, https://espcopter.com/wp-content/uploads/2018/11/pro2-300x300.png 300w, https://espcopter.com/wp-content/uploads/2018/11/pro2-350x351.png 350w, https://espcopter.com/wp-content/uploads/2018/11/pro2-100x100.png 100w, https://espcopter.com/wp-content/uploads/2018/11/pro2-150x150.png 150w" sizes="(max-width: 502px) 100vw, 502px" /></h1>
<h1>Arduino Code</h1>
<pre class="">#include 

const char WiFiAPPSK[] = "";
WiFiServer server(80);

#define blueLed 16
#define redLed 2
#define greenLed 0

int red = 0, green = 0, blue = 0;

String strial;
String inString = ""; 
int currentColor = 0;
void setup() {
  Serial.begin(9600);

  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(blueLed, OUTPUT);

  
 setupWiFi();

}

void loop() {
WiFiClient client = server.available();
 Serial.println("waiting... ");

  Serial.println(client);
  if (client ) {
    while (client.connected()) {
      while(1){
      if (client.available()) {
   
        int inChar;
        inChar = client.read();


     if (isDigit(inChar)) {
    // convert the incoming byte to a char 
    // and add it to the string:
    inString += (char)inChar; 
  }

   if (inChar == '*') {
    // do something different for each value of currentColor:
    switch (currentColor) {
      case 0:    // 0 = red
        red = 4*inString.toInt();
        // clear the string for new input:
        inString = "";
        break;
      case 1:    // 1 = green:
        green = 4*inString.toInt();
        // clear the string for new input:
        inString = "";
        break;
    }
    currentColor++;
  }
  // if you get a newline, you know you've got
  // the last color, i.e. blue:
  if (inChar == '?') {
    blue = 4*inString.toInt();
    // clear the string for new input:
    inString = "";
    // reset the color counter:
    currentColor = 0;
  }
    }

   analogWrite(blueLed,PWMRANGE-blue);
  analogWrite(redLed, PWMRANGE-red);
  analogWrite(greenLed, green); 
  
    }

   // Serial.println("Client disconnected.");
   // client.stop();
 } 

 }
}


void setupWiFi(){
  WiFi.mode(WIFI_AP);

  // Do a little work to get a unique-ish name. Append the
  // last two bytes of the MAC (HEX'd) to "Thing-":
  uint8_t mac[WL_MAC_ADDR_LENGTH];
  WiFi.softAPmacAddress(mac);
  String macID = String(mac[WL_MAC_ADDR_LENGTH - 2], HEX) +
                 String(mac[WL_MAC_ADDR_LENGTH - 1], HEX);
  macID.toUpperCase();
  String AP_NameString = "ESPCopter";

  char AP_NameChar[AP_NameString.length() + 1];
  memset(AP_NameChar, 0, AP_NameString.length() + 1);

  for (int i=0; i&lt;AP_NameString.length(); i++)
    AP_NameChar[i] = AP_NameString.charAt(i);

   WiFi.softAP(AP_NameChar, WiFiAPPSK);

   server.begin();
}
</pre>
<h1>Processing Code</h1>
<pre class="">import processing.net.*; 
import controlP5.*;
Client myClient; 
ControlP5 cp5;

String command= "";

void setup() {
   size(500, 500,P3D);
   background(0);
    myClient = new Client(this, "192.168.4.1", 80); 
   println(myClient.ip());  
   
  cp5 = new ControlP5(this);
  cp5.addColorWheel("colorWheel", 125 , 125 , 225 ).setRGB(color(128,0,255));
  noStroke();
    
}

 void draw() {

   command =  cp5.get(ColorWheel.class,"colorWheel").b() + "*" + cp5.get(ColorWheel.class,"colorWheel").g() + "*" +cp5.get(ColorWheel.class,"colorWheel").r() + "?" ;


 
 }
 void colorWheel(int theValue) {
 println("from client: " + command);
 myClient.write(command);

}
 
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://espcopter.com/2018/11/27/rgb-led-control-with-processing/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Button Control with Processing</title>
		<link>https://espcopter.com/2018/11/27/button-control-with-processing/</link>
					<comments>https://espcopter.com/2018/11/27/button-control-with-processing/#respond</comments>
		
		<dc:creator><![CDATA[metehanemlik]]></dc:creator>
		<pubDate>Tue, 27 Nov 2018 19:42:27 +0000</pubDate>
				<category><![CDATA[IoT and ESPcopter with Processing 3]]></category>
		<guid isPermaLink="false">http://espcopter.com/?p=1114</guid>

					<description><![CDATA[Screenshot Arduino Code: &#160; #include const char WiFiAPPSK[] = ""; WiFiServer server(80); #define blueLed 16 #define redLed 2 #define greenLed 0 [&#8230;]]]></description>
										<content:encoded><![CDATA[<h2>Screenshot</h2>
<p><img decoding="async" class="alignnone size-full wp-image-1119" src="http://espcopter.com/wp-content/uploads/2018/11/control_Led_Pr.png" alt="" width="407" height="338" srcset="https://espcopter.com/wp-content/uploads/2018/11/control_Led_Pr.png 407w, https://espcopter.com/wp-content/uploads/2018/11/control_Led_Pr-350x291.png 350w, https://espcopter.com/wp-content/uploads/2018/11/control_Led_Pr-300x249.png 300w" sizes="(max-width: 407px) 100vw, 407px" /></p>
<h2>Arduino Code:</h2>
<p>&nbsp;</p>
<pre class="">#include 

const char WiFiAPPSK[] = "";
WiFiServer server(80);

#define blueLed 16
#define redLed 2
#define greenLed 0


void setup() {
  Serial.begin(9600);

  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(blueLed, OUTPUT);

  
 setupWiFi();

}

void loop() {
WiFiClient client = server.available();
 Serial.println("waiting... ");

  Serial.println(client);
  if (client ) {
    while (client.connected()) {
      while(1){
      if (client.available()) {
   
        int inChar;
        inChar = client.read();
        Serial.println(inChar);
         switch (inChar) {
         case 'A':
         analogWrite(blueLed,0);
         break;
         case 'a':
         analogWrite(blueLed,PWMRANGE);
         break;
         case 'B':
         analogWrite(redLed, PWMRANGE);
         break;
         case 'b':
         analogWrite(redLed, 0);
         break;
         case 'C':
         analogWrite(greenLed, PWMRANGE); 
         break;
         case 'c':
         analogWrite(greenLed, 0); 
         break;
      } 
    }
    }

   // Serial.println("Client disconnected.");
   // client.stop();
 } 

 }
}




void setupWiFi(){
  WiFi.mode(WIFI_AP);

  // Do a little work to get a unique-ish name. Append the
  // last two bytes of the MAC (HEX'd) to "Thing-":
  uint8_t mac[WL_MAC_ADDR_LENGTH];
  WiFi.softAPmacAddress(mac);
  String macID = String(mac[WL_MAC_ADDR_LENGTH - 2], HEX) +
                 String(mac[WL_MAC_ADDR_LENGTH - 1], HEX);
  macID.toUpperCase();
  String AP_NameString = "ESPCopter";

  char AP_NameChar[AP_NameString.length() + 1];
  memset(AP_NameChar, 0, AP_NameString.length() + 1);

  for (int i=0; i&lt;AP_NameString.length(); i++)
    AP_NameChar[i] = AP_NameString.charAt(i);

   WiFi.softAP(AP_NameChar, WiFiAPPSK);

   server.begin();
}
</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2>Processing Code:</h2>
<pre class="">import processing.net.*;
import controlP5.*;
Client myClient;
ControlP5 cp5;
String command= "";
int c1,c2;
void setup() {
size(400, 300,P3D);
background(0);
myClient = new Client(this, "192.168.4.1", 80);
println(myClient.ip());

cp5 = new ControlP5(this);

cp5.addToggle("colorA")
.setPosition(150,100)
.setSize(50,20)
.setValue(false)
.setMode(ControlP5.SWITCH)
;

cp5.addToggle("colorB")
.setPosition(150,150)
.setSize(50,20)
.setValue(false)
.setMode(ControlP5.SWITCH)
;

cp5.addToggle("colorC")
.setPosition(150,200)
.setSize(50,20)
.setValue(false)
.setMode(ControlP5.SWITCH)
;

}

void draw() {

}

// function colorA will receive changes from
// controller with name colorA
void colorA(boolean theFlag) {
println("a button event from colorA: "+theFlag);
background(0,255,0);
if(theFlag == true){
command = "A";
} else {
command = "a";
}

myClient.write(command);
}

// function colorB will receive changes from
// controller with name colorB
void colorB(boolean theFlag) {
println("a button event from colorB: "+theFlag);
background(0,0,255);
if(theFlag == true){
command = "B";
} else {
command = "b";
}
myClient.write(command);
}

// function colorC will receive changes from
// controller with name colorC
void colorC(boolean theFlag) {
println("a button event from colorC: "+theFlag);
background(255,0,0);
if(theFlag == true){
command = "C";
} else {
command = "c";
}

myClient.write(command);
}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://espcopter.com/2018/11/27/button-control-with-processing/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
