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
ADVERTISEMENT
Sep 12, 2013
How can I pass the name from the user input to the constructor ?
Code:
#include <iostream>
#include <string>
using namespace std;
class myClass {
[Code]....
View 6 Replies
View Related
Feb 20, 2013
I am having trouble finding the solution to printing the contents of a variable. Here is my code:
void OnSize(HWND hwnd, UINT flag, int width, int height) {
std::wstringstream ss (std::wstringstream::in | std::wstringstream::out);
ss << flag;
std::wstring myStr = ss.str();
MessageBoxW(hwnd,myStr, L"Window Resized",NULL);
}
Note, I have #defined UNICODE at the beginning. The compiler tells me this for myStr.
std::wstring myStr
Error: No suitible conversion function from "std::wstring" to "LPCWSTR" exits
View 2 Replies
View Related
Feb 21, 2014
why I'm getting an error with this code? I'm trying to pass a string as a parameter and use it to open a file:
class txt{
private:
string tempstring;
vector<string> strings;
char filename[10]; //not using this right now
[code]....
but I get this error:
[Note] no known conversion for argument 1 from 'const string {aka const std::basic_string<char>}' to 'const char*'
I thought strings were just const character arrays
View 3 Replies
View Related
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
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
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
Jan 24, 2013
Why do we not pass the address of the string during printf or scanf functions like we do for Integer or float variable types?
View 2 Replies
View Related
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
View Related
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
Jan 27, 2014
I'm creating simple console application using Code::Blocks to allow me to pass parameters from other application to replace string within text/registry file before execute the registry merge. Passing parameters to console already success. Now I only have problem with reading file. Example of first line in the registry file is as below.
Windows Registry Editor Version 5.00
However when read into string and output to console using 'cout', it will be show as below with spaces in between.
W i n d o w s R e g i s t r y E d i t o r V e r s i o n 5 . 0 0
Below is my code.
ifstream f("install.reg");
string s((istreambuf_iterator<char>(f)), istreambuf_iterator<char>());
cout << s;
View 6 Replies
View Related
Jan 23, 2013
I've been given an assignment with the below questions.
1. What is the difference between pass by reference & pass by pointers?
2. What is the use of the initialization list in the constructor?
3. What is meant by a reference & its advantage?
4. Class has a reference, pointer and a const. Is it possible to write the copy constructor & assignment operator overloading funciton? how? ( Since reference is there, I'm not sure on how to write for it)
5. Example for a variable decleration and definition? (I know for function but for variable don kw how)
6. static and const static what is the difference??
View 1 Replies
View Related
Jul 2, 2014
// explain difference between pass by value and pass by reference
void addOne(int i)
{
i++;
}
void addOne(int& i)
{
i++;
}
View 2 Replies
View Related
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
Apr 17, 2013
i think i understand both concept. i know that pass by value is that the function receiving those values makes actually a copy of those parameters. Passing by reference makes the variable in the main function to actually see those changes in the other function, instead of a copy, and apply them to the variable in the main function. my question is, why would i pass it by reference if i just can make a return type function.
View 5 Replies
View Related
Nov 27, 2014
I need to put my Dice() function as pass by reference and something as a pass by value, it can be in the same function.
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
[Code].....
View 6 Replies
View Related
Dec 4, 2014
I'm trying to understand the pass by value-result. The code I have came up with so far only does by value and by reference, which I understand. The value-result is what has me stumped, and honestly I am unsure how to write the function for it. Here's my code so far...
#include <iostream>
using namespace std;
// Function prototypes.
void swapByValue(int, int, int);
void swapByRef(int&, int&, int&);
[Code] ....
View 4 Replies
View Related
Nov 25, 2013
(Pass-by-Value vs. Pass-by-Reference)
Write a complete C++ program with the two alternate functions specified below, each of which simply triples the variable count defined in main. Then compare and contrast the two approaches. These two functions are
a) function tripleByValue that passes a copy of count by value, triples the copy and returns the new value and
b) function tripleByReference that passes count by reference via a reference parameter and triples the original value of count through its alias (i.e., the reference parameter).
View 7 Replies
View Related
Mar 30, 2014
In this program, I have to ask the user for an employee, then the program will check to see if the file for that employee exist, if it doesnt then it will automatically create the file.
ReadNew function reads the file....check to see if it exist
CreateNew function creates a new file.
In my code I have no problem with the first part of reading file.. and my createnew function works in other programs where I am asking for input of file name to create the file name. However in this code I cannot figure how to automatically pass the input filename from the ReadNew function to the CreateNew function. I can't ask the user to enter the name a second time, so I have to pass the input filename into both functions
Here is my code.
Code:
//Create a file, append to it, and read it.
#include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>
using namespace std;
char filename[256];
string n;
string filelist;
void CreateNew(ofstream & FileNew);
[Code]...
View 3 Replies
View Related
Apr 24, 2013
I am trying to pass an array of objects however i m finding some problems.
pieces.h
Code: class Cpiece{
public:
Cpiece* board[8][8];// array of objects
virtual char getcolor() =0;
virtual char setcolor(char colour)=0;
[Code] .....
View 10 Replies
View Related
Apr 10, 2014
I need to pass an array of 10 instances of a custom class to a function. The snippets of code are posted below. How would I do this right?
The prototype:
Code:
int Search(Vertex vertex[], ofstream &outfile);
The implementation in the main function.
Code:
Search(vertex[10], outfile);
View 2 Replies
View Related
Sep 23, 2014
I have read about it in my book and also on this website but i still have things uncleared....
View 11 Replies
View Related
Jun 29, 2014
I'm playing around with GTK+ 2.x and currently I have a button to call a function like so:
Code:
void selectmod(GtkWidget *downloadbutton, GtkComboBox *modlist, gchar *data){
gchar *mod = gtk_combo_box_get_active_text(modlist);
printf("
%s", mod);
}
How can I pass the *mod variable to another function?
View 9 Replies
View Related
Jun 16, 2014
I have never seen anyone pass by const copy and there probably is a reason. I know that the compiler ignores top level const-ness of function arguments. There are functions which take arguments without manipulating those arguments return the result, for example the C Standard Library funcion double sqrt (double x). The function shouldn't modify it's argument, but it can since the argument isn't const.Take these two functions for example:
double square_root_1(double arg)
{
arg = 7; // we won't get the desired results
return arg * arg;
[code]....
So isn't it better to pass by const copy to make sure that you (or someone else) don't by accident modify the argument? The only disadvantage I see is that it makes the code too verbose.
View 10 Replies
View Related
Mar 15, 2013
I'm trying to pass an array from one function to another without resorting to pointers and I have to use Pass by Reference. I can't seem to figure it out. I've been looking at many examples and just don't get it.
the function createAbc makes an array populated with the Alphabet. I need to pass that into my display function so that i can work with the array there. I don't know how to pass it in there... :(
#include "stdafx.h"
#include <iostream>
#include <cctype>
[Code]...
View 9 Replies
View Related
Apr 24, 2014
Why the value does not return; Here is code
#include <iostream>
#include <string>
#include <ctime> // to use the time function
#include <cstdlib>
using namespace std;
int getUserChoose (int);
[Code] ....
here is the output
Welcome to the program of Rock, Paper, Scissors
The computer is ready to play the game
Are you ready to play the game
Y for yes and N for no
Y
R = Rock; P = Paper; S = Scissors
R
You have choose Rock
1TN
1RM
0U
0C
View 5 Replies
View Related