void setup() {
Serial.begin(9600);
}
void loop() {
long dividend = 12345;
long divisor = 123456;
int decimal_places = 1000;
char result[decimal_places+2]; // +2 for decimal point and null terminator
memset(result, 0, sizeof(result)); // initialize result to all zeroes
// Handle negative values
bool negative = false;
if ((dividend 0) || (dividend > 0 && divisor < 0)) {
negative = true;
}
dividend = abs(dividend);
divisor = abs(divisor);
// Calculate integer part of quotient
long quotient = dividend / divisor;
ltoa(quotient, result, 10);
// Add decimal point
strcat(result, ".");
// Calculate decimal part of quotient
long remainder = dividend % divisor;
for (int i = 0; i < decimal_places; i++) {
remainder *= 10;
quotient = remainder / divisor;
remainder = remainder % divisor;
result[i+2] = quotient + '0';
}
// Print result
if (negative) {
Serial.print("-");
}
Serial.println(result);
while (1) {} // stop program from continuing indefinitely
}
Category: ARDUINO
Speed Control of DC Motor with ARDUINO + Encoder and L298 DC motor Driver Shield
Arduino Uno and Single Axis TB6560 Step Motor Control

The Step motor and arduino step driver setup
Continue reading Arduino Uno and Single Axis TB6560 Step Motor Control
Multiple BH1750 on i2c bus Digital Light Sensor + Arduino (16xBH1750)
This project was made with the collobaration of my brother who is proffessor at the faclty of architecture at Selcuk University Konya Turkey. He asked me
for a system which could measure light intensity in 16 different points in a house. And then I started to make search and decided to do the job with
- Arduino mega.
- We purchased 20 pcs BH1750 light sensors from eBay at a very good prices.
– Two pieces CD74HC4067 Analog/Digital MUX Breakout
Continue reading Multiple BH1750 on i2c bus Digital Light Sensor + Arduino (16xBH1750)
Building a DSLR 3 Axis Camera Slider
FUTABA S3010 Sevo Control with ARDUINO
#include
Servo FUTABAservo; //Servo Objesi oluştutulur
void setup()
{
FUTABAservo.attach(9); // Servonun sinyali Arduinoda 9 nolu pine bağlanır
}
void loop()
{
FUTABAservo.write(0); // 0 derece ye git
delay(2000); // 2 saniye bekle
FUTABAservo.write(90); // 90 dereceye git
delay(1000); // 1 saniye bekle
}
ARDUINO uyumlu ChipKit Max32 ile ilk Çalışmalar | First Demo with ARDUINO Compatible Chipkit Max32 Board
ChipKit ile Ultasonik sensör ile mesafe ölçümü.
Arduino uyumlu ChipKit (http://chipkit.net/) ilk yaptığım uygulama, oldukça başarılı bir arayüzü bulunmakta (http://chipkit.net/started/) ve programlaması beklediğimden daha kolaymış.
Ultrasonik sensörden mesafe ölçmek için aşağıdaki test programını kullandım
const int inputPin = 4; //Yansıyan sinyal girişi
const int outputPin = 5; //Sinyal gönderme çıkışı
const int ledpin = 3;
void setup()
{
Serial.begin(9600);
pinMode(ledpin,OUTPUT);
pinMode(inputPin,INPUT);
pinMode(outputPin,OUTPUT);
}
void loop()
{
digitalWrite(outputPin,LOW) ;
delayMicroseconds( 2 ) ;
digitalWrite(outputPin,HIGH) ;
delayMicroseconds( 10 ) ;
digitalWrite(outputPin,LOW) ;
int distance =pulseIn(inputPin,HIGH) ;
distance = distance/58; // ölçü birimini cm çevir
Serial.println(distance); //hesaplanan değeri bilgisayara gönder
delay(50) ;
if(distance >= 50)
{
digitalWrite(ledpin,HIGH) ;
}
else
digitalWrite(ledpin,LOW) ;
}
Bu kart ile değişik uygulamaları kolayca yapabileceiğimi düşünüyorum. ebay’ dan getirttiğim farklı farklı sesnörler bulunmakta onları da sırasıyla denemek için sabırsızlanıyorum.
Dr Süleyman Canan



You must be logged in to post a comment.