21 Temmuz 2019 Pazar

Proje 1 : El açma kapama eldiveni

bluetooth kontrollu el açma kapama eldiveni
4 tensli 2 uste 2 alta olmak uzere el açma ve kapama için eldiven sonraki aşama parmak kontrolu link

25 Mayıs 2019 Cumartesi

Airties 5760 Auto Restart Code

       

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.firefox.options import Options
import time, traceback

def get_html(link):
    service_log_path = './ghostdriver.log'
    options = Options()
    options.add_argument('-headless')
    driver = webdriver.Firefox(executable_path="./geckodriver/geckodriver", firefox_options=options)
    driver.get(link)
    try:
        time.sleep(1)
        driver.find_element_by_id("uiPostPassword").send_keys("XXXXXXXXX")
        driver.find_element_by_id("__ML_ok").click()
        time.sleep(1)
        driver.get("http://192.168.2.1/tools/tools.html")
        time.sleep(1)
        driver.find_element_by_id("__ML_restart_button").click()
        time.sleep(1)
        driver.switch_to_alert().accept()
        print "airties success restarting"
    except NoSuchElementException:
        var = traceback.format_exc()
        print var
    
get_html("http://192.168.2.1/loginmain.html")

9 Mayıs 2019 Perşembe

Kadıköy Engelli Merkezi Düzayak Olmalı

Merhaba

    Dün sabah ilk defa Kadıköy engelli merkezine gitmeye karar verdik. Liftli aracımla koşuyolunun yokuşlu sokaklarına çıktıktan sonra dar ve ince bir sokağa girdik. Araba park edecek yer bulamayınca engelli merkezin önündeki trafik park yapılmazları kaldırıp oraya yanaşmayı denedik bu sefer görevliler itiraz edince bakıp çıkacaz demek zorunda kaldık. Neyse engelli merkezinin 2 farklı girişi var.Bunu fark ettim.Alt katta olması sebebi ile uzunca bi rampa yapılmış ve bir de az ilerde  özel asansör mevcut. Tabii arabaların arasından kaldırıma çıkılabilirse içeri girilebiliyor. Bunlar sonradan düşünülüp yapıldığı için fiziksel engeli olanlar için güzel şeyler.Ama kadıköy belediyesi engelli merkezi için iyi şeyler değil çünkü tamamen yanlış bir yere konumlandırılmış bir merkez burası.Fiziksel engelli insanlar yokuşlu yerleri sevmez.Ne kendi arabalarıyla geldiğinde ne de tek başına geldiklerinde yakuşlu bir yerde yardım almadan asla oraya ulaşamaz.Bu yüzden bu engelli merkezinin konumunun daha düz ayak, rahatça park edilebilen otobusle, trenle, minibusle tek başına kimseden yardım almadan ulaşılan bir yerde olması gerekir. Kadıköy'de bu kriterlere uygun bir çok mekan olduğuna eminim başta büyük parklarımızın içi bu tip merkezler için fazlasıyla uygun.Lütfen bu konuya önem verip engelli merkezini kadıköy içinde uygun bir yere taşıyın.Çünkü Kadıköy her yönünüyle örnek bir belediyedir diğer belediyeler için.Kadıköy'ü örnek alacaklar için önlerine herşeyi doğru yapan bir belediye örneği koyalım.

İyi Günler

Fiziksel Engelli Yurttaş
Selahaddin Yıldırım

10 Nisan 2019 Çarşamba

Alber E-motion M12 Battery Installation

There is a grey label which is fixed to battery pack, on it. If you push it up, there are screws.They need soldering for serial connection.



5 Nisan 2019 Cuma

Android Bluetooth Connection To HC-05

Sending Data to HC-05


 package com.example.a6dofbt;  
 import android.app.Activity;  
 import android.app.ProgressDialog;  
 import android.bluetooth.BluetoothAdapter;  
 import android.bluetooth.BluetoothDevice;  
 import android.bluetooth.BluetoothSocket;  
 import android.content.Intent;  
 import android.os.AsyncTask;  
 import android.os.Bundle;  
 import android.util.Log;  
 import android.view.View;  
 import android.widget.Button;  
 import android.widget.EditText;  
 import android.widget.SeekBar;  
 import android.widget.SeekBar.OnSeekBarChangeListener;  
 import android.widget.TextView;  
 import android.widget.Toast;  
 import java.io.IOException;  
 import java.io.OutputStream;  
 import java.util.UUID;  
 public class dof extends Activity {  
   private OutputStream outStream = null;  
   private BluetoothDevice device;  
   private TextView title;  
   private SeekBar clamp ;  
   private SeekBar base;  
   private SeekBar leg;  
   private SeekBar waist;  
   private SeekBar head;  
   private SeekBar chest;  
   private EditText motorno;  
   private Button add;  
   private Button subtract;  
   private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");  
   private static String address = "00:00:00:00:00:00";  
   private BluetoothAdapter btAdapter = null;  
   private BluetoothSocket btSocket = null;  
   private static final int REQUEST_ENABLE_BT = 1;  
   private boolean isBtConnected = false;  
   private ProgressDialog dialog;  
   @Override  
   protected void onCreate(Bundle savedInstanceState) {  
     super.onCreate(savedInstanceState);  
     setContentView(R.layout.dof);  
     MotorBar clamp = new MotorBar(0,200, "Clamp");  
     MotorBar head = new MotorBar(1,200, "Head");  
     MotorBar chest = new MotorBar(2,200, "Chest");  
     MotorBar waist = new MotorBar(3,200, "Waist");  
     MotorBar leg = new MotorBar(4,200, "Leg");  
     MotorBar base = new MotorBar(5,200, "Base");  
     clamp.bar = (SeekBar) findViewById(R.id.seekBarOne);  
     head.bar = (SeekBar) findViewById(R.id.seekBarTwo);  
     chest.bar = (SeekBar) findViewById(R.id.seekBarThree);  
     waist.bar = (SeekBar) findViewById(R.id.seekBarFour);  
     leg.bar = (SeekBar) findViewById(R.id.seekBarFive);  
     base.bar = (SeekBar) findViewById(R.id.seekBarSix);  
     clamp.text = (TextView) findViewById(R.id.textOne);  
     head.text = (TextView) findViewById(R.id.textTwo);  
     chest.text = (TextView) findViewById(R.id.textThree);  
     waist.text = (TextView) findViewById(R.id.textFour);  
     leg.text = (TextView) findViewById(R.id.textFive);  
     base.text = (TextView) findViewById(R.id.textSix);  
     title = (TextView) findViewById(R.id.title);  
     try {  
       Bundle b = this.getIntent().getExtras();  
       address = (String) b.get("address");  
       title.setText(address);  
       /*  
       btAdapter = BluetoothAdapter.getDefaultAdapter();  
       device = btAdapter.getRemoteDevice(address);  
       btSocket = device.createInsecureRfcommSocketToServiceRecord(MY_UUID);  
       BluetoothAdapter.getDefaultAdapter().cancelDiscovery();  
       btSocket.connect();  
       outStream = btSocket.getOutputStream();  
       outStream.write("w".getBytes());  
       */  
       new BTbaglan().execute();  
     } catch(Exception e) {  
       errorExit("Error", e.getLocalizedMessage());  
     }  
     //checkBTState();  
     add = (Button) findViewById(R.id.add);  
     subtract = (Button) findViewById(R.id.subtract);  
     motorno = (EditText) findViewById(R.id.motorno);  
     motorno.setText("0");  
     add.setOnClickListener(new View.OnClickListener() {  
       @Override  
       public void onClick(View v) {  
         try {  
           String mno = String.valueOf(motorno.getText());  
           outStream.write(mno.getBytes());  
           outStream.flush();  
           Thread.sleep(30);  
           outStream.write("w".getBytes());  
           outStream.flush();  
         } catch(Exception e) {  
           errorExit("Final Error", "no write on stream "+e.getLocalizedMessage());  
         }  
       }  
     });  
     subtract.setOnClickListener(new View.OnClickListener() {  
       @Override  
       public void onClick(View v) {  
         try {  
           String mno = String.valueOf(motorno.getText());  
           outStream.write(mno.getBytes());  
           outStream.flush();  
           Thread.sleep(30);  
           outStream.write("e".getBytes());  
           outStream.flush();  
         } catch(Exception e) {  
           errorExit("Final Error", "no write on stream for button"+e.getLocalizedMessage());  
         }  
       }  
     });  
     int maxV = 500;  
     MotorBar[] motors = {clamp, head, chest, waist, leg, base};  
     for(int i=0; i < motors.length; i++) {  
       final MotorBar m = motors[i];  
       m.bar.setMax(maxV);  
       m.bar.setProgress(motors[i].value);  
       m.bar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {  
         int progressValue = 0;  
         public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {  
           progressValue = progress;  
         }  
         @Override  
         public void onStartTrackingTouch(SeekBar seekBar) { }  
         @Override  
         public void onStopTrackingTouch(SeekBar seekBar) {  
           seekBar.setProgress(progressValue);  
           m.value = progressValue + 50;  
           m.text.setText(m.name +": "+String.valueOf(m.value));  
           try {  
             String mno = String.valueOf(m.no);  
             outStream.write(mno.getBytes());  
             outStream.flush();  
             Thread.sleep(500);  
             String mv = String.valueOf(m.value);  
             outStream.write(mv.getBytes());  
             outStream.flush();  
           } catch(Exception e) {  
             errorExit("Fatal Error", "no write on stream for bar "+e.getLocalizedMessage());  
           }  
         }  
       });  
     }  
   }  
   private void errorExit(String title, String message){  
     Toast msg = Toast.makeText(getBaseContext(),  
         title + " - " + message, Toast.LENGTH_SHORT);  
     msg.show();  
     finish();  
   }  
 /*  
   @Override  
   public void onPause() {  
     super.onPause();  
     if (outStream != null) {  
       try {  
         outStream.flush();  
       } catch (IOException e) {  
         errorExit("Fatal Error", "In onPause() and failed to flush output stream: " + e.getMessage() + ".");  
       }  
     }  
     try   {  
       btSocket.close();  
     } catch (IOException e2) {  
       errorExit("Fatal Error", "In onPause() and failed to close socket." + e2.getMessage() + ".");  
     }  
   }  
   private void checkBTState() {  
     if(btAdapter==null) {  
       errorExit("Fatal Error", "Bluetooth Not supported. Aborting.");  
     } else {  
       if (!btAdapter.isEnabled()) {  
         //Prompt user to turn on Bluetooth  
         Intent enableBtIntent = new Intent(btAdapter.ACTION_REQUEST_ENABLE);  
         startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);  
       }  
     }  
   }  
   @Override  
   public void onBackPressed() {  
     super.onBackPressed();  
     Disconnect();  
   }  
   private void Disconnect() {  
     if(btSocket != null) {  
       try{  
         btSocket.close();  
       } catch (Exception e) {  
       }  
     }  
     finish();  
   }  
   @Override  
   public void onResume() {  
     super.onResume();  
     try {  
       btSocket = device.createRfcommSocketToServiceRecord(MY_UUID);  
     } catch (IOException e) {  
       errorExit("Fatal Error", "In onResume() and socket create failed: " + e.getMessage() + ".");  
     }  
     btAdapter.cancelDiscovery();  
     try {  
       btSocket.connect();  
     } catch (IOException e) {  
       try {  
         btSocket.close();  
       } catch (IOException e2) {  
         errorExit("Fatal Error", "In onResume() and unable to close socket during connection failure" + e2.getMessage() + ".");  
       }  
     }  
     try {  
       outStream = btSocket.getOutputStream();  
     } catch (IOException e) {  
       errorExit("Fatal Error", "In onResume() and output stream creation failed:" + e.getMessage() + ".");  
     }  
   }  
   private void setMotor(MotorBar motor) {  
     String no = String.valueOf(motor.no);  
     String v = String.valueOf(motor.value);  
     sendData(no);  
     try {  
       Thread.sleep(20);  
     } catch (InterruptedException e) {  
       e.printStackTrace();  
     }  
     sendData(v);  
   }  
   private void sendData(String message) {  
     byte[] msgBuffer = message.getBytes();  
     try {  
       if(!btSocket.isConnected()) {  
         btSocket = device.createInsecureRfcommSocketToServiceRecord(MY_UUID);  
         BluetoothAdapter.getDefaultAdapter().cancelDiscovery();  
         btSocket.connect();  
       }  
       outStream.write(msgBuffer);  
     } catch (IOException e) {  
       String msg = "Sending data failed" + e.getMessage();  
       errorExit("Fatal error", msg);  
     }  
   }  
   @Override  
   protected void onDestroy() {  
     super.onDestroy();  
   }  
 */  
   public class BTbaglan extends AsyncTask<Void, Void, Void> {  
     private boolean ConnectSuccess = true;  
     @Override  
     protected void onPreExecute() {  
       super.onPreExecute();  
       try {  
         dialog = ProgressDialog.show(dof.this, "Baglanıyor...", "Lütfen Bekleyin");  
       } catch(Exception e) {  
         errorExit2("Fatal error", e.getLocalizedMessage());  
       }  
     }  
     @Override  
     protected Void doInBackground(Void... devices) {  
       try {  
         if (btSocket == null || !isBtConnected) {  
           btAdapter = BluetoothAdapter.getDefaultAdapter();  
           BluetoothDevice device = btAdapter.getRemoteDevice(address);  
           btSocket = device.createInsecureRfcommSocketToServiceRecord(MY_UUID);  
           BluetoothAdapter.getDefaultAdapter().cancelDiscovery();  
           btSocket.connect();  
           outStream = btSocket.getOutputStream();  
         }  
       } catch (IOException e) {  
         ConnectSuccess = false;  
       } catch(Exception e) {  
         errorExit2("Fatal error", e.getLocalizedMessage());  
       }  
       return null;  
     }  
     @Override  
     protected void onPostExecute(Void result) {  
       super.onPostExecute(result);  
       if (!ConnectSuccess) {  
         // msg("Baglantı Hatası, Lütfen Tekrar Deneyin");  
         Toast.makeText(getApplicationContext(), "Bağlantı Hatası Tekrar Deneyin", Toast.LENGTH_SHORT).show();  
         finish();  
       } else {  
         //  msg("Baglantı Basarılı");  
         Toast.makeText(getApplicationContext(), "Bağlantı Başarılı", Toast.LENGTH_SHORT).show();  
         isBtConnected = true;  
       }  
       dialog.dismiss();  
     }  
     private void errorExit2(String title, String message){  
       Toast msg = Toast.makeText(getBaseContext(),  
           title + " - " + message, Toast.LENGTH_SHORT);  
       msg.show();  
     }  
   }  
 }  

15 Mart 2019 Cuma

HC-05 python connection

       

import bluetooth

print "Searching for devices..."
print ""
nearby_devices = bluetooth.discover_devices()
num = 0
print "Select your device by entering its coresponding number..."
for i in nearby_devices:
 num+=1
 print num , ": " , bluetooth.lookup_name( i )

selection = input("> ") - 1
print "You have selected", bluetooth.lookup_name(nearby_devices[selection])
bd_addr = nearby_devices[selection]
port = 1
sock = bluetooth.BluetoothSocket( bluetooth.RFCOMM )
sock.connect((bd_addr, port))
print "Everything is OK, Start to write"
while 1:
 data = raw_input()
 if len(data) == 0: break
 sock.send(data)
sock.close()

4 Mart 2019 Pazartesi

Bluetooth 4.0 Arduino At-09

       


include 
SoftwareSerial mySerial(2, 3); // RX, TX
int PIN_EN_OUT = 4;
int PIN_STATE_IN = 5;


void setup() {
  // put your setup code here, to run once:
  mySerial.begin(9600);
  Serial.begin(9600);
  Serial.println("start at 09 bt");

  sendCommand("AT");
  sendCommand("AT+ROLE0");
  sendCommand("AT+UUID0xFFE0");
  sendCommand("AT+CHAR0xFFE1");
  sendCommand("AT+NAMESeloBT");
  sendCommand("AT+PIN123456");
}

void sendCommand(const char * command){
  Serial.print("Command send :");
  Serial.println(command);
  mySerial.println(command);
  //wait some time
  delay(100);
  
  char reply[100];
  int i = 0;
  while (mySerial.available()) {
    reply[i] = mySerial.read();
    i += 1;
  }
  //end the string
  reply[i] = '\0';
  Serial.print(reply);
  Serial.println("Reply end");
}

void readSerial(){
  char reply[50];
  int i = 0;
  while (mySerial.available()) {
    reply[i] = mySerial.read();
    i += 1;
  }
  //end the string
  reply[i] = '\0';
  if(strlen(reply) > 0){
    Serial.println(reply);
    Serial.println("We have just read some data");
  }
}

void loop() {
  readSerial();
  delay(500);
}

Solenoid valve for Urine bag