SPI_IIC_LCD library on Arduino - arduino

SPI_IIC_LCD/MCP23008.cpp:23:28: error: call of overloaded ‘write(int)’ is ambiguous
If you get this type of error when trying to compile the SPI_IIC_LCD library for arduino 1.0 you need to edit MCP23008.cpp and insert (uint8_t) where Wire.write is called like so:
Wire.write((uint8_t)0x00);
I took me a while to figure out, hopefully i can save someone some time by posting this.

Related

First token could not be read or is not the keyword 'FoamFile' in OpenFOAM

I am a beginner to programming. I am trying to run a simulation of a combustion chamber using reactingFoam.
I have modified the counterflow2D tutorial.
For those who maybe don't know OpenFOAM, it is a programme built in C++ but it does not require C++ programming, just well-defining the variables in the files needed.
In one of my first tries I have made a very simple model but since I wanted to check it very well I set it to 60 seconds with a 1e-6 timestep.
My computer is not very powerful so it took me for a day aprox. (by this I mean I'd like to find a solution rather than repeating the simulation).
I executed the solver reactingFOAM using 4 processors in parallel using
mpirun -np 4 reactingFOAM -parallel > log
The log does not show any evidence of error.
The problem is that when I use reconstructPar it works perfectly but then I try to watch the results with paraFoam and this error is shown:
From function bool Foam::IOobject::readHeader(Foam::Istream&)
in file db/IOobject/IOobjectReadHeader.C at line 88
Reading "mypath/constant/reactions" at line 1
First token could not be read or is not the keyword 'FoamFile'
I have read that maybe some files are empty when they are not supposed to be so, but I have not found that problem.
My 'reactions' file have not been modified from the tutorial and has always worked.
edit:
Sorry for the vague question. I have modified it a bit.
A typical OpenFOAM dictionary file always contains a Foam::Istream named FoamFile. An example from a typical system/controlDict file can be seen below:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
During the construction of the dictionary header, if this Istream is absent, OpenFOAM ceases its operation by raising an error message that you have experienced:
First token could not be read or is not the keyword 'FoamFile'
The benefit of the header is possibly to contribute OpenFOAM's abstraction mechanisms, which would be difficult otherwise.
As mentioned in the comments, adding the header entity almost always solves this problem.

9 axes motion shield

I am having some issues getting stock code to compile for my 9 axes motion shield. I have a github repository with all of the motion libraries I have, the example code, and the error messages I am getting.
I am using Arduino 1.7.1 IDE on Windows 7 64-bit.
I have tried using sample code for the sensor instead of for the shield and could not get that to compile either. I have tested example code built into the IDE to ensure that I can compile something and I was even able to interface with my Arduino MEGA 2560 with said code.
I have searched Google and Stack exchange a fair bit and have not managed to come up with any solutions.
The main error I can not figure out is:
"
C:\Users\LJI_eric\Documents\Arduino\sketch_mar20a\sketch_mar20a.ino: In function 'void setup()':
sketch_mar20a:63: error: 'OPERATION_MODE_NDOF' was not declared in this scope
mySensor.setOperationMode(OPERATION_MODE_NDOF);"
OPERATION_MODE_NDOF is a mode that is defined in BNO055.h and is an array of operation modes. I tried several other modes to no avail.
I would appreciate any and all help.
On line 84, 87 and 91 you have made a new line inside a string. You can not do that on the Arduino. If you want to break a string up in more lines you should end the string where you would break it, and start the string again on the new line, like this.
Serial.println("Move the device around and then place it at one position.\n"
"Change the threshold and duration to increase the difficulty level.");
Then you should change OPERATION_MODE_NDOF to BNO055_OPERATION_MODE_NDOF

Error during compile of Megablink demo using freeRTOS for atmega2560 using WinAVR

The following RTOS .c files compile fine during 'make':
task.c, queue.c, tasks.c, croutines.c, list.c
Then I get the following error:
serial.c: In function 'xSerialPortReInit'
serial.c: 665:error: 'ulWantedBaud' undeclared (first use in this
function)
serial.c: 665:error: (Each undeclared identifier is reported only
once for each function it appears in)
make: ***[serial.o]Error 1
I have checked that all include files identified in serial.c are available
Why do you think it is an include file problem? ulWantedBaud is more likely to be a function parameter, or file scope variable, that is misspelled. The AVR demo in the official FreeRTOS download (whic is very old and probably not the best reference) contains a serial port init function with such a parameter, although not a re-init function as per your post:
xComPortHandle xSerialPortInitMinimal( uint32_t ulWantedBaud, uint8_t uxQueueLength );
(This snippet is from http://www.freertos.org/a00098.html)

QOpenGLShaderProgram: is possible to make error output nice?

I'm implementing some numerical algorithms on GPU via OpenGL and Qt.
But i am not very familiar with it.
I want to extract some functions from my current shader to some "shader library" and use it in my other shaders by string interpolation. It not hard to implement but i don't know how handle shader's compile errors
I use following code to compile shader
QOpenGLShaderProgram *shaderProgram = new QOpenGLShaderProgram();
if (!shaderProgram->addShaderFromSourceFile(QOpenGLShader::Fragment,fragmentShaderFileName)) {
qDebug() << "Failed to compile fragment shader";
//..........
When some compile error appears Qt print following message (an example)
QOpenGLShader::compile(Fragment): 0:331(9): error: syntax error, unexpected NEW_IDENTIFIER, expecting ',' or ';'
*** Problematic Fragment shader source code ***
//my shader source code
Is possible to catch error line number and use it to build my own error message? (with highlighted line)
According to the Qt documentation, you can use QOpenGLShaderProgram::log():
Returns the errors and warnings that occurred during the last link()
or addShader() with explicitly specified source code.
You can then parse the resulting string to build your own error message.

Coding errors between the Arduino Uno and SDI-12 interface on Decagon Devices

I have been working on a project recently using a sensor for electrical conductivity in soil (A 5TE sensor from Decagon Devices) with my Arduino Uno. I am ready to code, and found this example code on GitHub (the example code is there when you scroll down the page). When trying to run it on the latest version of Arduino, it gave me these compilation errors:
sketch_dec15a:7: error: expected initializer before 'void'
sketch_dec15a:4: error: 'SDISerial' does not name a type
sketch_dec15a:9: error: expected initializer before 'void'
sketch_dec15a.ino: In function 'void loop()':
sketch_dec15a:22: error: 'connection' was not declared in this scope
NOTE: I believe I installed the library correctly, but am not 100% certain...more like 85%.
What's wrong with the code and how can it be made to work?
The example code is wrong. Look at the compilation errors. The first thing it says is:
sketch_dec15a:7: error: expected initializer before 'void'
So what it's saying is that it found something that said void and expected to see something else first. void occurs only twice in your code, so we can't be far. Let's take a look at the code immediately surrounding it the first void:
char tmp_buffer[4];
char sensor_info[]
//initialize variables
void setup(){
connection.begin();
Serial.begin(9600);//so we can print to standard uart
//small delay to let the sensor do its startup stuff
delay(3000);//3 seconds should be more than enough
}
Right before the void setup(){ is //initialize variables. That's just a comment, and not code, so it doesn't relly count. Looking back one more line we see:
char sensor_info[]
Something is wrong with that line. Work on it and see if you can figure it out (check the other lines for "hints"). If you can't figure it out, the answer is right below (put your mouse over it to see it):
It needs a semicolon ";" at the end to complete the statement. Because the semicolon is missing, it thinks "void setup(){" is part of the previous statement.

Resources