پروژه های پارسکدرز
5.77K subscribers
2 photos
1 file
513K links
آخرین پروژه های پارسکدرز را در این کانال ببینید

پارسکدرز اولین بازار کار آنلاین ایران

https://parscoders.com
Download Telegram
پیاده سازی یک سناریوی ساده در Omnetpp با استفاده از Inet

#education_and_tutoring, #network_شبکه

یک شبکه متشکل از دو گره متحرک داریم. ماژول گره، extendشدۀ ماژول AdhocHost است. 
- نیازمندی 1: هر گره به صورت متناوب، هر یک ثانیه یک بار، یک پیام Hello را در محدودۀ رادیویی خودش broadcast کند.
- نیازمندی 2: هر گره اگر پیامی را از گره دیگر دریافت کرد، آنرا در لاگ خود نمایش دهد.   
____________________________________________________________________.net file__________________________________________________________
module Node extends AdhocHost {
    @class(Node);
}
network MobileNetwork
{
    parameters:
        int numHosts;
        @display("bgb=600,400");        
    submodules:
        visualizer: IntegratedVisualizer {
            parameters:
                @display("p=100,50");
        }
        host[numHosts\]: Node;
} 
_______________________________________________________Node.h_______________________________________________
#ifndef NODE_H_
#define NODE_H_
#include <iostream>
#include <omnetpp.h>
#include <../../inet/src/inet/common/InitStages.h>
using namespace omnetpp;
using namespace inet;
using namespace std;
class Node: public cModule {
protected:
    virtual int numInitStages() const override { return NUM_INIT_STAGES; }
    virtual void initialize(int) override;
    virtual void handleMessage(cMessage*);
};
#endif
________________________________________________________Node.cc__________________________________________________
#include"Node.h"
Define_Module(Node);
void Node::initialize(int stage) {
}
void Node::handleMessage(cMessage *msg) {
}
_____________________________________________________.ini file________________________________________________________
[Config MobileNetwork\]
network = MobileNetwork
*.numHosts = 2
**.constraintAreaMinX = 0m
**.constraintAreaMinY = 0m
**.constraintAreaMinZ = 0m
**.constraintAreaMaxX = 600m
**.constraintAreaMaxY = 400m
**.constraintAreaMaxZ = 0m
*.*.ipv4.configurator.networkConfiguratorModule = ""
*.*.numWlanInterfaces = 0
*.host*.mobilityType = "MassMobility"
*.host*.mobility.changeInterval = 0.5s
*.host*.mobility.changeAngleBy = uniform(-30deg, 30deg)
*.host*.mobility.speed = 100mps


توسط خریدار: h_heydari

اطلاعات بیشتر:
https://pc0.ir/p/94758

@ParscodersCom
حل اشکال برنامه نویسی
🔸 فوری

#assembly, #c_programming, #c_plus_plus_programming, #software_testing, #electrical_engineering

با سلام
قطعه کد زیر به زبان C  نوشته شده در مورد Integer square root است بخشی کوچکی از قطعه از برنامه نویسی اسمبلی Integer square root الهام گرفته است که فکر کنم شامل دو خط 
#define TOP2BITS(x) ((x & (3L << (BITSPERLONG-2))) >> (BITSPERLONG-2))
و            r = (r << 2) + TOP2BITS(x); x <<= 2; /* NOTE 2 */     است

ممنون میشم این دو خط را توضیح بدید که چطوری نوشته شده است؟


توسط خریدار: کاربر267869

اطلاعات بیشتر:
https://parscoders.com/project/333789/حل-اشکال-برنامه-نویسی

t.me/ParscodersCom
پروژه آردوینو (5821)

#arduino

پروژه آردوینو میخواستم
جهت فعال سازی سنسور ضربه و ویبر
#define Dig_pin 7
int Dig_out = LOW;
int Ana_out = 0;
void setup() {
   Serial.begin(9600);
}
void loop() {
   Dig_out = digitalRead(Dig_pin);
   Ana_out = analogRead(A0);
   Serial.print("Anaolog : ");
   Serial.print(Ana_out);
   Serial.print("          Digital :");
   Serial.println(Dig_out);
   delay(500);
}
میخوام اگر سنسور غیرفعال شد تو این چرخه یه خروجی پنج ولت رو برام فعال کنه   
تو برد uno r3
حقیقت عجله ای یه مقدار


توسط خریدار: کاربر110164

اطلاعات بیشتر:
https://parscoders.com/project/389307/پروژه-آردوینو-5821

t.me/ParscodersCom
51922 پروژه آردوینو 

#arduino

سلام وقت بخیر  پروژه آردوینو داشتم برای فعال سازی سنسور ویبره و لرزه  جهت فعال سازی سنسور ضربه و ویبر 
#define Dig_pin 7
int Dig_out = LOW;
int Ana_out = 0;
void setup() {
   Serial.begin(9600);
}
void loop() {
   Dig_out = digitalRead(Dig_pin);
   Ana_out = analogRead(A0);
   Serial.print("Anaolog : ");
   Serial.print(Ana_out);
   Serial.print("          Digital :");
   Serial.println(Dig_out);
   delay(500);
}
 میخوام اگر سنسور غیرفعال شد تو این چرخه یه خروجی پنج ولت رو برام فعال کنه  تو برد uno r3  کد برنامه رو میخوام فقط  زمان هم یک روزه
2800*


توسط خریدار: nikotex

اطلاعات بیشتر:
https://parscoders.com/project/389324/51922-پروژه-آردوینو 

t.me/ParscodersCom
پروژه آردوینو (78420)

#arduino

پروژه حضور غیاب این هست که با rfid rc522 باید کارت هارو شناسایی کنه و با ماژول وای فا esp01s به  وب سرور بفرسته اطلاعات  از برد یونو هم استفاده کردمحالا کد هارو زدم و کار میکنه اما ماژول وای فا به وب سرور و اینترنت وصل نمیشه//ESP8266 Code:                                           #include <ESP8266WiFi.h>#include "Adafruit_MQTT.h"#include "Adafruit_MQTT_Client.h"// WiFi parameters#define WLAN_SSID  "GalaxyA05s"#define WLAN_PASS  "m13871387"// Adafruit IO#define AIO_SERVER      "io.adafruit.com"#define AIO_SERVERPORT  1883#define AIO_USERNAME    "mahdiabbasi"#define AIO_KEY         "aio_LZNe916ieuzRODahhhWPcSj0oqyg"   // Obtained from account info on io.adafruit.com.// Create an ESP8266 WiFiClient class to connect to the MQTT server.WiFiClient client;// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);Adafruit_MQTT_Publish Attendance = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/feed name");char ID;/* Sketch Code **/void setup() {  Serial.begin(115200);  Serial.println(F("Adafruit IO Example"));  // Connect to WiFi access point.  Serial.println(); Serial.println();  delay(10);  Serial.print(F("Connecting to "));  Serial.println(WLAN_SSID);  WiFi.begin(WLAN_SSID, WLAN_PASS);  while (WiFi.status() != WL_CONNECTED) {    delay(500);    Serial.print(F("."));  }  Serial.println();  Serial.println(F("WiFi connected"));  Serial.println(F("IP address: "));  Serial.println(WiFi.localIP());  // connect to adafruit io  connect();}// connect to adafruit io via MQTTvoid connect() {  Serial.print(F("Connecting to Adafruit IO... "));  int8_t ret;  while ((ret = mqtt.connect()) != 0) {    switch (ret) {      case 1: Serial.println(F("Wrong protocol")); break;      case 2: Serial.println(F("ID rejected")); break;      case 3: Serial.println(F("Server unavail")); break;      case 4: Serial.println(F("Bad user/pass")); break;      case 5: Serial.println(F("Not authed")); break;      case 6: Serial.println(F("Failed to subscribe")); break;      default: Serial.println(F("Connection failed")); break;   }    if(ret >= 0)      mqtt.disconnect();    Serial.println(F("Retrying connection..."));    delay(5000);  }  Serial.println(F("Adafruit IO Connected!"));}void loop() {  // ping adafruit io a few times to make sure we remain connected  if(! mqtt.ping(3)) {    // reconnect to adafruit io    if(! mqtt.connected())      connect();  }   if ( Serial.available() ) { // Update and send only after 1 seconds   char a = Serial.read();   ID = a;      if (! Attendance.publish(ID)) {   //Publish to Adafruit      Serial.println(F("Failed"));    } else {      Serial.println(F("Sent!"));    }}}من این کد رو برای اتصال به وای فا و adafruit دارم ولی موقعی که آپلود میکنم کد رو نه به وای فا وصل میشه نه به adafruitبرنامه موقع کامپایل ران میشه و ارور هم نمیده ولی به وای فا و adafruit وصل نمیشه


توسط خریدار: Hamyarprozhe

اطلاعات بیشتر:
https://parscoders.com/project/503839/پروژه-آردوینو-78420

t.me/ParscodersCom
45288 - پروژه زبان C++

#c_plus_plus_programming

یه برنامه به زبان C++ داشتم
خروجی و برنامه یه گراف ساده با الگوریتم داکسترا میخواستم
// A C++ program for Dijkstra's single source shortest path algorithm. // The program is for adjacency matrix representation of the graph #include <stdio.h> #include <limits.h> // Number of vertices in the graph #define V 9 // A utility function to find the vertex with minimum distance value, from // the set of vertices not yet included in shortest path tree int minDistance(int dist[\], bool sptSet[\]) { // Initialize min value int min = INT_MAX, min_index; for (int v = 0; v < V; v++) if (sptSet[v\] == false && dist[v\] <= min) min = dist[v\], min_index = v; return min_index; } // A utility function to print the constructed distance array int printSolution(int dist[\], int n) { printf("Vertex Distance from Source\n"); for (int i = 0; i < V; i++) printf("%d tt %d\n", i, dist[i\]); } // Function that implements Dijkstra's single source shortest path algorithm // for a graph represented using adjacency matrix representation void dijkstra(int graph[V\][V\], int src) { int dist[V\]; // The output array. dist[i\] will hold the shortest // distance from src to i bool sptSet[V\]; // sptSet[i\] will be true if vertex i is included in shortest // path tree or shortest distance from src to i is finalized // Initialize all distances as INFINITE and stpSet[\] as false for (int i = 0; i < V; i++) dist[i\] = INT_MAX, sptSet[i\] = false; // Distance of source vertex from itself is always 0 dist[src\] = 0; // Find shortest path for all vertices for (int count = 0; count < V-1; count++) { // Pick the minimum distance vertex from the set of vertices not // yet processed. u is always equal to src in the first iteration. int u = minDistance(dist, sptSet); // Mark the picked vertex as processed sptSet[u\] = true; // Update dist value of the adjacent vertices of the picked vertex. for (int v = 0; v < V; v++) // Update dist[v\] only if is not in sptSet, there is an edge from // u to v, and total weight of path from src to v through u is // smaller than current value of dist[v\] if (!sptSet[v\] && graph[u\][v\] && dist[u\] != INT_MAX && dist[u\]+graph[u\][v\] < dist[v\]) dist[v\] = dist[u\] + graph[u\][v\]; } // print the constructed distance array printSolution(dist, V); } // driver program to test above function int main() { /* Let us create the example graph discussed above */ int graph[V\][V\] = {{0, 4, 0, 0, 0, 0, 0, 8, 0}, {4, 0, 8, 0, 0, 0, 0, 11, 0}, {0, 8, 0, 7, 0, 4, 0, 0, 2}, {0, 0, 7, 0, 9, 14, 0, 0, 0}, {0, 0, 0, 9, 0, 10, 0, 0, 0}, {0, 0, 4, 14, 10, 0, 2, 0, 0}, {0, 0, 0, 0, 0, 2, 0, 1, 6}, {8, 11, 0, 0, 0, 0, 1, 0, 7}, {0, 0, 2, 0, 0, 0, 6, 7, 0} }; dijkstra(graph, 0); return 0; }
یه نمونه کد حل شده بود
"برای درک بهتر موضوع، مثال زیر مورد بررسی قرار خواهد گرفت.مجموعه sptSet در ابتدا خالی است و فاصله...


توسط خریدار: مهندس خوب

اطلاعات بیشتر:
https://parscoders.com/project/549549/45288-پروژه-زبان-c-plus-plus

t.me/ParscodersCom
الکترونیک - 115145

#electronics

سلام خسته نباشیدحدودا هزینش چقدر میشه؟#include “stm8s.h” #include “stm8s_clk.h” #include “stm8s_gpio.h” #include “stm8s_tim4.h”// ———————–– // پین‌ها // ———————–– #define LEFT_PORT GPIOD #define LEFT_PIN GPIO_PIN_2#define RIGHT_PORT GPIOD #define RIGHT_PIN GPIO_PIN_3#define RELAY_PORT GPIOB #define RELAY_PIN GPIO_PIN_5// ———————–– // millis() // ———————–– volatile uint32_t g_millis = 0;uint32_t myMillis(void) { uint32_t ms; disableInterrupts(); ms = g_millis; enableInterrupts(); return ms; }INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23) { TIM4_ClearITPendingBit(TIM4_IT_UPDATE); g_millis++; }// ———————–– // تبدیل پالس چشمک‌زن به حالت پایدار // ———————–– bool stableIndicator(GPIO_TypeDef* port, GPIO_Pin_TypeDef pin, uint32_t* lastOn) { uint32_t now = myMillis(); bool raw = (GPIO_ReadInputPin(port, pin) == RESET);if (raw) *lastOn = now;// اگر در 250ms اخیر روشن بوده → هنوز روشن حساب کنif (now - *lastOn < 250) return true;return false;}// ———————–– // متغیرها // ———————–– uint32_t lastLeft = 0; uint32_t lastRight = 0;bool waiting = false; bool relayOn = false; bool holdPhase = false; bool lastWasLeft = false;uint32_t tStart = 0; uint32_t tOffDelay = 0;// ———————–– // Setup // ———————–– void setup() { CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);GPIO_Init(LEFT_PORT, LEFT_PIN, GPIO_MODE_IN_PU_NO_IT);GPIO_Init(RIGHT_PORT, RIGHT_PIN, GPIO_MODE_IN_PU_NO_IT);GPIO_Init(RELAY_PORT, RELAY_PIN, GPIO_MODE_OUT_PP_LOW_FAST);TIM4_TimeBaseInit(TIM4_PRESCALER_128, 124);TIM4_ITConfig(TIM4_IT_UPDATE, ENABLE);TIM4_Cmd(ENABLE);enableInterrupts();}// ———————–– // Loop // ———————–– void loop() { uint32_t now = myMillis();bool leftOn = stableIndicator(LEFT_PORT, LEFT_PIN, &lastLeft);bool rightOn = stableIndicator(RIGHT_PORT, RIGHT_PIN, &lastRight);// مرحله 1: شروع با یک جهتif (!relayOn && !waiting && !holdPhase){ if (leftOn) { waiting = true; lastWasLeft = true; tStart = now; } else if (rightOn) { waiting = true; lastWasLeft = false; tStart = now; }}// مرحله 2: جهت دوم زیر 1 ثانیهif (waiting){ if (lastWasLeft && rightOn && (now - tStart < 1000)) { GPIO_WriteHigh(RELAY_PORT, RELAY_PIN); relayOn = true; waiting = false; holdPhase = true; } if (!lastWasLeft && leftOn && (now - tStart < 1000)) { GPIO_WriteHigh(RELAY_PORT, RELAY_PIN); relayOn = true; waiting = false; holdPhase = true; } if ((now - tStart) >= 1000) waiting = false;}// مرحله 3: نگه داشتن رله تا خاموش شدن واقعی جهت دومif (holdPhase){ if (lastWasLeft) { if (!rightOn) { tOffDelay = now; // شروع تایمر 3 ثانیه holdPhase = false; } } else { if (!leftOn) { tOffDelay = now; holdPhase = false; } }}// مرحله 4: خاموش کردن رله بعد از 3 ثانیهif (!holdPhase && relayOn){ // اگر دوباره پالس آمد → تایمر ریست شود if (lastWasLeft && rightOn) { holdPhase = true; } else if (!lastWasLeft && leftOn) { holdPhase = true; } else { // اگر 3 ثانیه کامل گذشت و هیچ...


توسط خریدار: nikotex

اطلاعات بیشتر:
https://parscoders.com/project/611696/الکترونیک-115145

t.me/ParscodersCom