C :: Arduino Programming - Control Motion Of Servo Motor

Jul 16, 2013

I am working on a project that requires using an arduino microcontroller to control the motion of a servo motor. The arduino language is pretty much C.

The original code is of the form:

Code:
#include <Servo.h>

Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created

int pos = 0; // variable to store the servo position

[Code] .....

But the problem is I don't want the motor's motion to behave linearly (constant increments of the pos variable). My desired motion is a sinusoidal like function. How to approach this?

I am quite new to programming, especially with microcontrollers. My guess is that instead of the pos+=1, I would need something like pos+=sin(argument). I am not sure what that argument should be.

View 4 Replies


ADVERTISEMENT

C :: Socket Programming And Console Control

Jan 4, 2014

I would like to make a program for final project, which can let me send any file to my computer at home, and i can access any files in my computer when i am not at home.sending and getting file will be with socket programming.

i would like to reach all folders in computer, not only the folder, where client program exist. how can i access other folders at remote computer by using my program?

View 4 Replies View Related

Visual C++ :: Make Transition From Console Programming To GUI Programming?

Nov 30, 2013

my a book or website where I can make a transition from console programming to GUI programming. I'm totally confused about this. I know how to program in console and can make a whole program based on console. I also know the OPP programming, but it's clear that nobody uses console programming anymore.

View 10 Replies View Related

C/C++ :: How To Pass String From VB6 Into Arduino

Mar 6, 2015

how to pass a string from vb6 into the gsm module ... i am posting vb6 code ... below code passes

check1.caption=11BNELE0455 to MSCOMM2.output...

Static col As Integer

col = 3
lbl: If excelws.Cells(10, col).Value = "" Then
excelws.Cells(9, col).Value = Format(Now, "dd/mm/yyyy")
If (check1.Value = 1) And (Timer1.Enabled = True) Then
excelws.Cells(10, 1).Value = check1.Caption

[Code]...

now i want to access this string a=0455 from c-code of arduino..how can i access this.. below is c-code for arduino uno.what is wrong with it.it is giving me error:invalid conversion from 'int' to 'const char*'.

//decalaration part of my code

#include <SoftwareSerial.h>
char inchar[80][5]; // Will hold the incoming character from the GSMshield
SoftwareSerial SIM900(7, 8);
String textForSMS;

[Code]...

View 1 Replies View Related

C :: Wireless Surveillance System Using Arduino And Zigbee?

Feb 11, 2014

I am trying to implement same thing as given in following images:

i m working on "Wireless surveillance system using zigbee".

But i want to add external PIR motion sensor and wireless zigbee module with Arduino.

The images are stored in SD card. but my goal is when the PIR detects any motion the image should be stored in memory card (Done in attached code)and then that image should be transferred through zigbee (Zigbee Tx is connected with Rx Pin0 and zigbee Rx is connected with Tx Pin1). PIR sensor output is connected with Pin7 of arduino.

So what are the additions/modifications do i require for transmitting image on Pin1 in following code.

I am using this code

Code:
// This is a motion-detect camera sketch using the Adafruit VC0706 library.
// On start, the Arduino will find the camera and SD card and turn
// on motion detection. If motion is detected, the camera will
// snap a photo, saving it to the SD card.
#include <Adafruit_VC0706.h>
#include <SD.h>

[code]....

View 8 Replies View Related

C :: Reading Button Input On Arduino Board

Mar 7, 2013

Okay so this is part of a small uni module around the arduino board. The task is to simulate traffic lights at a junction. At the moment my code below runs through the sequence with 2 seperate lights. When one set of lights turns RED , the other turns GREEN.In my main loop method I need to add a button for a crossing. I want to be able to check if the button is pressed at each of the delays but do not want to have to hold it down.I have thought about putting it at the top of the loop but then the program will only check if button is pressed in that point therefore the user will have to hold it down?

Code:

int green1 = 13 ;
int amber1 = 12 ;
int red1 = 11 ;

int green2 = 6 ;
int amber2 = 7 ;
int red2 = 8 ;
}

[code]....

View 5 Replies View Related

C++ :: Arduino Robot - Virtual Controller And Path Map

Jul 14, 2014

I know how to create your basic programm that compiles as a CLI or exports and/or saves data to a .txt file... But how does one build a GUI?

I ask because I am currently working on a programm for my Arduino controlled robot, in which I want to have a virtual on screen controller next to a map of my bots path.

View 4 Replies View Related

C/C++ :: Comparing Time-based-responses From Two IR Sensors (Arduino)

Apr 9, 2015

I am building a project with an Arduino Uno that involves using analogue IR sensors to detect fast motion. By placing one sensor on top of the other, I want to be able to attain a variable integer from the difference in time between the responses of the sensors.

Here is my code I have so far, it is essentially for detecting motion for 1 sensor and then converting it into a MIDI note depending on how far away the motion is detected. There is also a part which compares the value from the previous time so that only above a certain amount of movement will trigger the note. I also have a variable delay to be controlled by a potentiometer.

Here is the datasheet for the sensors I'm using.

#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();

int currentvalA = 0; //current sensor A value
int previousvalA = 0; //previous sensor A value
int valA = 0; // value to store sensor
const int valchangeA = 40; //motion change value
int del = 0; //variable delay value

[Code] .....

View 2 Replies View Related

C# :: Change Form Control Properties From User Control

May 24, 2014

I have researched quite extensively, experimented, and still cannot seem to change the properties of a control on an active winform from a user control.

So I have a user control which populates each dynamically added tab page in a tab control.

I have a textbox in the user control which I would like to type in, capture the text_change event, and change the text of the label in the winform.

View 14 Replies View Related

C# :: Bind DatePicker Control To DataGrid Control (column)?

Apr 25, 2014

How do I bind a DATE column in a DataGridView Control to a DatePicker control (using C#)? I already have the DataGridView control bound to a database stored procedure which takes a DATE value as a parameter and selects joining table based on the results.

View 7 Replies View Related

C++ :: SDL - How To Handle Mouse Motion Input

Oct 19, 2013

I am using SDL 2.0. But I don't know how to handle mouse input. Do you think you can explain of how to do that? Or give me a link that explains that really great?

I know how to handle a mouse button that presses down for a sec.

Code:
if (event.type == SDL_MOUSEBUTTONDOWN){
if (event.button.button == SDL_BUTTON_LEFT){
// Do something . . .
}
}

But not how to handle the mouse input of what the mouse is hovering over and that.

Like in a start menu of a game. I want a button for example to appear blue when I hover over it and when I click on it. It should start the game for example.

View 6 Replies View Related

C++ :: Visual Arrow Following Motion Of Ball?

Aug 25, 2013

I have created plane as floor and sphere as ball. I used physics equations to it and ball falls under gravity. Now i want to attach visual arrow to this ball which moves with it according to velocity direction. If ball bounces then direction of velocity is changed so does arrow.

View 1 Replies View Related

C/C++ :: Trapezoidal Motion Profile Using Discrete Method?

Mar 9, 2015

I'm trying to program an arduino to generate a Trapezoidal Motion Profile to control a DC motor with a quadrature encoder.

Essentially, the user will input the desired Target Position, Max Velocity and Acceleration (decel = -accel) and the code will calculate the target position versus time which will then be compared with the actual position. The result will then be subject to a PID calculation

My initial assumption was that I could use basic Newtonian physics to determine position (i.e. PT = P0 + V0T + 1/2AT2, VT = V0 + AT). However, after reading through documentation for pre-existing motion controllers, I discovered that the prevalent method was to use a discrete time method, which is as follows:

VK = VK-1 + A (A = Acceleration)
PK = PK-1 + VK-1 + A/2

I'm having a hard time understanding quite how this equation would generate the target position versus time. In the case of Velocity, it seems to just add the acceleration to the current velocity. But what about everything in between?

View 2 Replies View Related

C# :: How To Make A Planet That Moves In A Circle Motion

Dec 7, 2014

i would like to make a planet that moves in a circle motion. I dont know how to start and how i can move a "planet" in a circle motion?

View 2 Replies View Related

C++ :: Simulation Of Motion Of Magnets On A Rod - Long Double Not Working

Apr 25, 2013

I'm currently working on a simulation of the motion of magnets on a rod. As part of it, there are arrays of the properties of the magnets:

long double *accelerations; // These will later be dynamically allocated depending on the number
long double *velocities; // of magnets
long double *positions;

However, when I go to compile this, the compiler gives me these error for the pointers:

error: two or more data types in declaration of 'accelerations'
error: two or more data types in declaration of 'velocities'
error: two or more data types in declaration of 'positions'

Apparently, the compiler isn't recognising long double* as a type and is instead reading is as the two types long and double*.

My compiler is MinGW 4.4.3

View 4 Replies View Related

C Sharp :: Motion Of Controls - Picturebox Position In Form?

Apr 8, 2012

I have a form with a picturebox and some buttons to move the picturebox. I don't want the user to guide the picturebox out of the form even by dragging the form border picturebox moves just in the form border, and also there is a button to guide the picturebox to the start position (start choose by user). What can i do?

View 1 Replies View Related

C++ :: Visual Studio 2013 - Leap Motion Virtual Piano

Sep 10, 2014

I currently have a project that requires me to build a leap motion Virtual Piano. I am using Windows Visual Studio 2013 and i plan to use C++ to code it.

I assume my first step is to create a virtual piano using C++.. Then, link it with leap motion interface.

Can i know which audio library suits my project and how can i go about doing it?

View 1 Replies View Related

C Sharp :: Full Code For Webcam Alert Motion Detector?

Mar 12, 2013

i have webcam i need to make project when this webcam detect any motion in his spot give me alert ,,,

View 4 Replies View Related

C/C++ :: Array Of Functions Pointing To In Class Functions With Arduino

May 3, 2013

At the moment im trying out with pointing to an array of functions. I got this working as following:

typedef void (* functionPtr) ();  
functionPtr functions[2][2]={{do11,do12}, {do21,do22}};    
void do11(){DEBUG_PRINTLN("11");}
void do12(){DEBUG_PRINTLN("12");}
void do21(){DEBUG_PRINTLN("21");}
void do22(){DEBUG_PRINTLN("22");}    
void loop(){
         A=0;
         B=1;
         functions[A][b]();
}  

But now I'm trying to use this to point to a function inside a class so instead of do11, i want to be able to point to Basic.Do11. Somehow this doesnt work and I keep on getting this message:

error: argument of type 'void (Basic::)()' does not match 'void (*)()'

View 2 Replies View Related

C :: UDO Socket Programming

Dec 18, 2014

I am trying to test my client-server socket program wherein the client connects to the server,client sends a message, server receives it and echo back to the client.So far, in the program server receives the message from the client, prints it BUT when it tries to send the message back to the client it shows an error.

sendto(): Invalid argument.I am new to socket programming.

Code:

//Server
#include<stdio.h> //printf
#include<string.h> //memset
#include<stdlib.h> //exit(0)
#include<netinet/in.h>
#include<sys/socket.h>
#define BUFLEN 512 //Max length of buffer
#define PORT 10003 //The port on which to listen for incoming data
}

[code]....

View 3 Replies View Related

C :: Parallel Port Programming - On / Off LED

Sep 9, 2014

I try to ON and OFF the LED's via parallel port. I connect the cathode of LED's with pin number 18 that is ground and anode of each LED is connected through a 1K resistor to pin 2 to 8. I write the following programe

Code:
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#define PORTID 0x378
void main(){
outportb(PORTID,0x00);
getch()
}

But when i connect the LEDS to the parallel port all the LEDS are LIT while i also change the 0x00 to 0xff and so on. But no effect on the LED's.

View 8 Replies View Related

C :: How To Check Dates In Programming

Mar 6, 2015

I'm supposed to make a program that can tell which date, out of any number of dates entered by the user, is the earliest date. However, this is based off another program that I did not do in the last chapter. Since it's a pretty simple program to use as the base for the more "generalized" one, I decided to make the more basic one that can only take two dates, first. If it was just one integer, I could just use date1 for the first date and date2 for the second date, but each date uses 6-8 separate numbers.

how do I tell it something like, "if(date1 < date2)", with date1 and date2 including their month, day, and year. I could do a separate integer name/tag (I forgot what they're called) for each number, but that sounds like doing a lot more adding and subtracting, and like it could easily get messy.Should I, or can I, add all the numbers under the "date" together to see which date has the "lowest number" or "earliest date", or should I somehow handle each number, that is month, day, and year, separately?Here's the code so far:

Code:

include <stdio.h>int main(void)
{
int date1, date2;
printf("Enter first date (mm/dd/yy):
");
scanf("%d/%d/%d", &date1);
printf("Enter second date (mm/dd/yy):
}

[code]....

View 10 Replies View Related

C :: Socket Programming Getting Segfault

May 22, 2013

I am trying to send a packet across a client/server communication. I am getting a seg fault (while running the program(It compiles fine)) when I try to read the neighbor file, You should be able to see this below the comment /***** Read neighbor file***/ :

Code:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
}

[code]....

View 2 Replies View Related

C++ :: Modular Programming With Template

May 16, 2014

I'm trying to create a stack of generic variable with template. This is the code.

BlockingStack.h
#include "stdafx.h"
#pragma once
template <class T>
class BlockingStack {
[Code] .....

I don't understand why ,but it dont work... It produce this errors:

1>Blocking_stack.obj : error LNK2019: riferimento al simbolo esterno "public: __thiscall BlockingStack<int>::BlockingStack<int>(int)" (??0?$BlockingStack@H@@QAE@H@Z) non risolto nella funzione _wmain
1>Blocking_stack.obj : error LNK2019: riferimento al simbolo esterno "public: __thiscall

[Code] ....

View 4 Replies View Related

C++ :: Can Be Used For Server Side Programming

Nov 28, 2013

I know this question must have been asked before, but the problem that I am facing is that I am using a library PoDoFo to parse PDF files. It seems that it is only compatible with C++.

Now I want the application to be web-based. That is, the user uploads a PDF file on the server, the server parses it and the parsed content is then sent back to the user.

Is such a thing possible with C++, or maybe any good work-arounds? Or should I look at server-side scripting languages like PHP and their respective libraries?

View 8 Replies View Related

C/C++ :: Programming Variable Name Rules?

Nov 13, 2014

Where are the c programming variable name rules defined? I usually use these two websites for figuring out these kind of things but I don't see it anywhere.

[URL]

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved